0

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

  1. PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'term' in 'where clause' when i clicking on taxonomy term
  2. 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
    ")->FetchField();
    
    print $tid->Name;
    $child=taxonomy_get_children($tid);
     foreach($child as $t)
     {
    $link = l($t->name, 'taxonomy/term/' . $t->tid)."<br>";
    print $link;
    }
    
0

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 >_>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.