Web Hosting Talk







View Full Version : Frustrated MySQL User


Studio64
06-10-2002, 06:31 AM
OK... I've been constructing a PM system for a site I work with and have run into a really studpid syntax problem.

View of MySQL table structure (http://std64.com/table.html)

OK.. So here's the problem....

The query
-- UPDATE message SET date=1 WHERE ID=1
functions perfectly and will execute w/out error

But, the query
-- UPDATE message SET read=1 WHERE ID=1
gets the error
=== You have an error in your SQL syntax near 'read=1 WHERE ID=1' at line 1


Any clues on the correct syntax for that statement?

choon
06-10-2002, 08:18 AM
Hi,

Can you try with the single quotes like below:

UPDATE message SET read='1' WHERE ID='1'

Just my thought as it might due to the code which issue the SQL query.

Let me know the result.

Thanks.

Kindest regards,
Choon

Originally posted by Studio64
OK... I've been constructing a PM system for a site I work with and have run into a really studpid syntax problem.

View of MySQL table structure (http://std64.com/table.html)

OK.. So here's the problem....

The query
-- UPDATE message SET date=1 WHERE ID=1
functions perfectly and will execute w/out error

But, the query
-- UPDATE message SET read=1 WHERE ID=1
gets the error
=== You have an error in your SQL syntax near 'read=1 WHERE ID=1' at line 1


Any clues on the correct syntax for that statement?

hostNOX
06-10-2002, 11:24 AM
UPDATE message SET read=1 WHERE ID=1
Should be...
UPDATE message SET read='1' WHERE ID='1' ( like he said tell me if it works for you. )

Lawrence
06-10-2002, 11:27 AM
Another guess without checking the documentation, but "read" may be a reserved word, in which case you may need to put double quotes around it.

Noldar
06-10-2002, 01:58 PM
I believe Lawrence is correct. READ is a MySQL Keyword. You may just want to rename that field to something else.

Richard

Studio64
06-10-2002, 04:27 PM
Yes.... It turns out read was a reserved word....

Thanks..