By jase951 on
I am trying to add taxonomy titles to my module.
So that a list of taxonomy titles appear for each post.
How do I add taxonomy titles of a certain category to my module?
I have... (from snippet)
$output .= " <br><div class=\"CLASS NAME\">\n";
$output .= " <span class=\"label2\">". t('TITLE') .":</span><br><br>\n";
$output .= " </div>\n";
$taxo_id .= GETS SUBMITTED TAXONOMY NUMBER;
$list_no .= 25;
$sql = "SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = $taxo_id AND STATUS = 1 LIMIT $list_no";
$output .= "<ul>";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
$output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
}
$output .= "</ul>";
but this sql error appears when submitting the form for this modules node.
user error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND status = 1 LIMIT 25' at line 1
query: SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = AND status = 1 LIMIT 25 in /LOCALHOST/public_html/includes/database.mysql.inc on line 66.
How do I solve this?
Comments
$taxo_id is evaluating to a
$taxo_id is evaluating to a blank. If you look at the error message it says "WHERE term_node.tid = ", then it starts the next part of the where clause. I assume that GETS SUBMITTED TAXONOMY NUMBER represents some code you didn't post, but that's where the problem is.
Thanks...
Sorted, I just added:
Thanks.