Jump to content

[SOLVED] Query problem


thefollower

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.