By yangke on
user warning: Unknown column 'n.language' in 'where clause' query: SELECT * FROM term_data WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL) AND ( vid = 1) in D:\xampp\htdocs\drupal\sites\default\modules\sheet\sheet.module on line 205.
line 205 and surroundings:
<?php
$errorcategory_vocabulary_vid = 1; // 1 is the errorcategory vocabulary 's vid
$sql = "SELECT * FROM {term_data} WHERE vid = %d";
$query_terms = db_query(db_rewrite_sql($sql), $errorcategory_vocabulary_vid);
?>
Where does the n. come from?
The term_data table does have a language column (I checked the database) ...
Comments
It comes from the
It comes from the db_rewrite_sql()
Not sure how to fix it though. Look through the documentation for db_rewrite_sql, and add some more variables to your function. That may (or may not!) solve the problem. It did for me in the past.
Contact me to contract me for D7 -> D10/11 migrations.
Thanks for pointing me in the
Thanks for pointing me in the right direction.
I ended up deleting the db_rewrite_sql and just using db_query(...)
I think this is a bug in the db_rewrite_sql function
It's not - and that function
It's not - and that function is actually quite important. It prevents people from seeing contents that they don't have grants to see. Without it, you run the potential of cutting any access modules/functions out of the loop, thereby opening a security hole in your system. It also cuts any language checks out of the system, and it appears that you are using a multi-lingual site. That's why you need to add the extra variables to the end of the function - it is running under the assumption that you are searching from a table different than the one you are searching from. By adding filling in the extra variables, you should be able to prevent the situation you are having.
Contact me to contract me for D7 -> D10/11 migrations.