I'm getting the following in the logs:
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 '(NOW(), b.last_reminder) AS date_diff FROM users a LEFT JOIN ac query: SELECT a.*, b.msg_cnt, DATEDIFF(NOW(), b.last_reminder) AS date_diff FROM users a LEFT JOIN account_reminder b ON b.uid=a.uid WHERE a.access=0 AND a.uid!=0 AND status=1 in /home/dcourt2/public_html/forum/includes/database.mysql.inc on line 121.

gil

Comments

Nigeria’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

Got the same error in drupal 5.1

prateek’s picture

I think its the same as:
http://drupal.org/node/123962

I am facing it on Drupal 5.1.

It seems that the query string is malformed. I am not able to see the actual query string, so I cannot comment further.

prateek’s picture

OK guys, I found the solution. But excuse me for its not in "patch" format.
just change the query line in cron hook function to the one given below:

$result=db_query("SELECT a.*, b.msg_cnt, TO_DAYS(CURDATE())-TO_DAYS(b.last_reminder) AS date_diff  FROM {users} a LEFT JOIN {account_reminder} b ON b.uid=a.uid WHERE a.access=0 AND a.uid!=0 AND status=1");

Looks like there is some bug in either PHP or MySQL. DATEDIFF function doesn't work at all.

gaijinu’s picture

Add table prefix:

$result=db_query("DELETE {account_reminder}.* FROM {account_reminder},{users} WHERE {account_reminder}.uid={users}.uid AND access!=0 AND {users}.uid!=0 AND status=1");

cojones’s picture

The delete is not valid SQL in any database except mysql, I know it doesn't work in postgres
This should work
DELETE FROM {account_reminder} WHERE account_reminder.uid in (SELECT users.uid FROM {users} WHERE access!=0 AND users.uid!=0 AND status=1)

jaydub’s picture

Status: Active » Fixed

The latest commit to CVS should take care of these issues. I've changed the table
structure to accomodate PostgreSQL and altered the date logic in the SQL as a result.

Please take a chance to test out!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.