At 9:39 AM -0600 1/11/08, Tony Furnivall wrote:
Hi!
I'm having a problem with the UPDATE syntax for MySQL
(aside - I hate products that tell me I have a syntax problem, but
don't tell me what it is - and then suggest that I go RTFM which is
equally uninformative:-()
I'm replacing the entire set of fields, WHERE a condition exists for
some of the fields, ie
UPDATE table_name SET field1 = ' value1', field2 = ' value2', field3
= ' value3, field4 = ' value4' WHERE field1 = ' value1' AND field2
= ' value2';
MySQL says that I have error 1064 'near WHERE field1 = ' value1' AND
field2 = ' value2'
but it doesn't say what therror is (grrr!)
Why the extra space before value1 (i.e., field1 = ' value1') ?
And where are the variables?
Shouldn't you be using something like:
UPDATE table_name SET field1 = '$value1',
That works for me.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php