thefollower Posted December 4, 2007 Share Posted December 4, 2007 Im not sure what i got wrong here but im getting this error: ou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'When) Values ('1', '2007-12-04 00:01:55')' at line 1 My query : $query = "INSERT INTO `unauthorized` (UserID,When) Values ('{$_SESSION['Current_User']}', '$Date')"; mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/80046-solved-query-problem/ Share on other sites More sharing options...
pocobueno1388 Posted December 4, 2007 Share Posted December 4, 2007 I think "when" might be a mysql reserved word. Try changing it to this $query = "INSERT INTO `unauthorized` (UserID,`When`) Values ('{$_SESSION['Current_User']}', '$Date')"; mysql_query($query) or die(mysql_error().'<p>'.$query); Link to comment https://forums.phpfreaks.com/topic/80046-solved-query-problem/#findComment-405590 Share on other sites More sharing options...
cooldude832 Posted December 4, 2007 Share Posted December 4, 2007 this is a good list of what NOT to use in your field names http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html it should be added to the sticky. Link to comment https://forums.phpfreaks.com/topic/80046-solved-query-problem/#findComment-405595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.