NYCPHP Meetup

NYPHP.org

[nycphp-talk] Problem with MySQL UPDATE syntax

Yitzchak Schaffer yitzchas at touro.edu
Fri Jan 11 10:33:42 EST 2008


Did you copy that query directly?  You're missing a quote to close value3.

Yitzchak Schaffer
Systems Librarian
Touro College Libraries
33 West 23rd Street
New York, NY 10010
Tel (212) 463-0400 x230
Fax (212) 627-3197
yitzchas at touro.edu


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!)
>
> My questions:
>
> My question is what is the appropriate way to expand the syntactic 
> construct of "where_condition", which is not otherwise explained!
>
> Help!
>
> Tony
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080111/cba2d807/attachment.html>


More information about the talk mailing list