BrianM Posted July 6, 2008 Share Posted July 6, 2008 Here is my code: <?php $result = mysql_query("SELECT Date FROM $table id=$id") or die(mysql_error()); ?> And here is the error I'm receiving: 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 '08-1111-E id=1' at line 1 Can anyone tell me what is wrong? Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted July 6, 2008 Share Posted July 6, 2008 Date is a special word in sql, either change your field name, or surround it in `backticks`. Quote Link to comment Share on other sites More sharing options...
trq Posted July 6, 2008 Share Posted July 6, 2008 Hmmm, your also missing your WHERE clause. <?php $result = mysql_query("SELECT `Date` FROM $table WHERE id=$id") or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
BrianM Posted July 6, 2008 Author Share Posted July 6, 2008 thorpe, thanks very much. You are right. It now works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.