Syntax Error

drw - April 1, 2009 - 17:46
Project:SIOC
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:drw
Status:active
Description

Sometimes received this warning:

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 'WHERE (n.language ='es' OR n.language ='' OR n.language IS NULL)' at
line 1 query: SELECT COUNT(*) as count from node where type = 'story' WHERE
(n.language ='es' OR n.language ='' OR n.language IS NULL)
in /mnt/disk2/pruebas/utplsite/modules/sioc/sioc.module on line 521.

What happend it ?

#1

Cloud - April 29, 2009 - 19:08

"where type = 'story'" WHERE should be "where type = 'story' AND"

Not sure why that is happening...

#2

Cloud - April 29, 2009 - 19:22

In the Drupal 5 and 6 modules, the line:

$stories_counter = db_result(db_query('SELECT COUNT(*) as count from {node} where type=\'story\''));

was changed to:

$stories_counter = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) as count from {node} where type=\'story\'')));

I'm not sure what the effect will be of removing the rewrite function...

scor, any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.