You will need to put single quotes around your variables in your SQL
statement.  Like this:

$sql = "UPDATE TABLE seminar SET
title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu
ilding'
,rm='$room'  WHERE id='$id'";

Without the quotes, SQL doesn't know that Something Amazing is supposed to
go together in the same string.

HTH

Sam Masiello
Software Quality Assurance Engineer
Synacor
(716) 853-1362 x289
[EMAIL PROTECTED]

 -----Original Message-----
From:   Chris Worth [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, August 01, 2001 12:36 PM
To:     [EMAIL PROTECTED]
Subject:        [PHP] SQL syntax error in PHP script.  dunno what's wrong



hey gang.

here is my sql statement from my php script.

$sql = "UPDATE TABLE seminar SET
title=$title,speaker=$speaker,event_date=$tdate,time=$time,bldg=$building
,rm=$room  WHERE id=$id";


it appears just like that in my code.

here is the $sql string echoed to the screen to verify the variables.


UPDATE TABLE seminar SET title=Something amazing,speaker=Mr.
Black,event_date=2001-08-05,time=11:00:am,bldg=BCC ,rm=201 WHERE id=48

all of the variable are valid.

here is my error.

1064: You have an error in your SQL syntax near 'TABLE seminar SET
title=Something
amazing,speaker=Mr.
Black,event_date=2001-08' at line 1

I'm baffled.


and I couldn't find error 1064 in the mysql manual.pdf either.

any ideas.  I know this is going to turn out to be something silly.

thanks,

chris




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to