When testing the comment module, I received the following error message:

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 'FROM node WHERE node_comment_statistics.nid = node.nid AND node.nid = 9' at line 1 query: UPDATE node_comment_statistics SET comment_count = 0, last_comment_timestamp = created, last_comment_name = '', last_comment_uid = uid FROM node WHERE node_comment_statistics.nid = node.nid AND node.nid = 9 in /home/scnt/public_html/includes/database.mysql.inc on line 124.

I have access control set to require approval for comments for authenticated users. I have TinyMCE installed and available for use by an autenticated user.

Despite the MySQL error message, I am still able to create the comment and it goes to the approval queue. However, when I select the comment for approval, I get the following error message:

Illegal choice in .

This is the first time I've submitted an issue, so if I've messed it up, or this isn't actually a bug, but my own user error, I apologize.
Roger

Comments

njkt’s picture

I am also receiving this error but only when trying to delete comments. Hopefulyl some information on this bug (hoping it's not my fault -_-) will be shared and fixed :)

Signe’s picture

The issue is that 'FROM' is not valid syntax for an UPDATE query.

UPDATE node_comment_statistics SET comment_count = 0, last_comment_timestamp = created, last_comment_name = '', last_comment_uid = uid FROM node WHERE node_comment_statistics.nid = node.nid AND node.nid = 2

The FROM should be a join, from the look of things.

This works:

UPDATE node_comment_statistics,node SET comment_count = 0, last_comment_timestamp = created, last_comment_name = '', last_comment_uid = uid WHERE node_comment_statistics.nid = node.nid AND node.nid = 2;

killes@www.drop.org’s picture

Status: Active » Fixed

fixed in cvs

KSA213755’s picture

I'm new at this. Do I just download the comment module from cvs and upload it to my site?
BTW, thanks for fixing it.

Roger

Crell’s picture

The beta4 tarball will never change. However, the code will be fixed in whatever the next release is, either beta5 or RC1 (still to be decided). That shouldn't be much longer, I'm guessing.

If you want the fix now!, your best bet is to use a CVS client to download the latest "HEAD" version. I'd recommend just grabbing everything rather than just the one module, since there has been a LOT of bugfixing in the past week or so.

KSA213755’s picture

Title: MySQL syntax error » Thanks Crell

Thanks Crell. I'll just wait for the next release as I'm just playing around with 4.7 as I learn how to use Drupal for an upcoming project.

greggles’s picture

Title: Thanks Crell » MySQL syntax error

KSA213755 - changing the title on an issue changes it for the whole issue, not just the comment. It's a different behavior from the forums, so it's hard to get used to.

I changed title back.

The Drupal Handbook page about CVS mentions that you can get a nightly tarball from http://drupal.org/files/projects/drupal-cvs.tar.gz that would get it for you without waiting for a BETA5/RC.

Anonymous’s picture

Status: Fixed » Closed (fixed)