i get this error:
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 id=' at line 1
this is my code:
mysql_query("SELECT id,message FROM $subject WHERE id=$id") or die ('Error: '.mysql_error ());
im confused because i (think) that the problem is with the $subject because when i replace it it works (more or less) and i use it (with the $subject) in another script which works. i assign the $subject earlier in the script so what the ....
MySql error
Moderator: General Moderators
Re: MySql error
Print the query before you run it - $subject is probably empty.
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: MySql error
You should make it like that:
mysql_query("SELECT id,message FROM '$subject' WHERE id='$id'") or die ('Error: '.mysql_error ());
mysql_query("SELECT id,message FROM '$subject' WHERE id='$id'") or die ('Error: '.mysql_error ());