user warning: You have an error in your SQL syntax

Johnson2 - January 6, 2009 - 06:04

I am recieving this error whenever I click on the node from my frontpage and directs to

.com/node/12 <- Where the error appears.

user warning: 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 n.status = 1 ORDER BY nid ASC' at line 1 query: SELECT n.nid, n.title FROM node n INNER JOIN term_node t ON n.nid = t.nid INNER JOIN term_data r ON t.tid = r.tid WHERE n.type = 'announcements' AND n.nid > 717 AND r.tid = AND n.status = 1 ORDER BY nid ASC in XXX/XXX/XXX/template.php on line 689.

Can you please tell me what am I doing wrong? thank you.

It looks like you have some

mdixoncm - January 6, 2009 - 07:29

It looks like you have some custom SQL in your template.php file (on line 689), probably something that is meant to bring you back all announcements that have a certain taxonomy term associated with them - BUT - for some reason the term ID is not being passed into the query.

I would be wary of chunks of SQL like this - 9 times out of 10 you can use the views module to achieve this sort of thing - but if your after a quick and easy fix, post the code around line 689 on here and we can figure out why it's going wrong.

Cheers,

Mike,
Computerminds offer Drupal development, consulting and training

 
 

Drupal is a registered trademark of Dries Buytaert.