Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.