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 Link to comment https://forums.phpfreaks.com/topic/113493-solved-help-on-array-please/ 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`. Link to comment https://forums.phpfreaks.com/topic/113493-solved-help-on-array-please/#findComment-583146 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()); ?> Link to comment https://forums.phpfreaks.com/topic/113493-solved-help-on-array-please/#findComment-583148 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. Link to comment https://forums.phpfreaks.com/topic/113493-solved-help-on-array-please/#findComment-583151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.