Jump to content

[SOLVED] insert query not working


jmr3460

Recommended Posts

What is wrong with this query. I keep getting this error message.

"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 event_title = 'Leap Into Recovery' ORDER BY id LIMIT 1' at line 1"

This is my query:

	$sql2 = "INSERT INTO calendar (first_day) VALUE (1) WHERE event_title = '$event' ORDER BY id LIMIT 1";

Can anyone tell me why this does not work? This column (first_day) is a bool, I have another query that uses this column to fetch an array that is echoed in a while satement.

Thanks for any help

Link to comment
https://forums.phpfreaks.com/topic/175307-solved-insert-query-not-working/
Share on other sites

OK I have a calendar and before this query I inserted three rows with the same information in it except for the date. I also have a while statement in another script that looks for the 1 in my first_day column and I just want to update the first row only so my other script does not show all three rows. Will this work:

UPDATE table WHERE event_title = '$event' LIMIT 1

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.