taxonomy term is not working when i am added any query code is added in blocks our taxonomy term is not working they give two kind of errors:


PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'term' in 'where clause' when i clicking on taxonomy term
Notice: Trying to get property of non-object in eval()  when i am added code in blocks
Here is my code:

$nid=arg(1);

$tid=db_query("SELECT th.tid FROM taxonomy_term_hierarchy th 
INNER JOIN taxonomy_term_data td ON th.tid=td.tid
INNER JOIN field_data_field_books book ON book.field_books_tid = th.tid
WHERE td.vid = '6' AND th.parent = '0'  AND book.entity_id = $nid
")-&gt;FetchField();

print $tid-&gt;Name;
$child=taxonomy_get_children($tid);
 foreach($child as $t)
 {
$link = l($t-&gt;name, 'taxonomy/term/' . $t-&gt;tid)."&lt;br&gt;";
print $link;
}
I can't see any 'term' in your where clausole, so it's probably because you forgot the single quote around $nid.

oh, when i have query problems, the first thing i do is printing them on screen to see what I'm sending to the db, you wont believe what i managed to write some times, but i blame my keyboard >_>