> Question is there something wrong with this syntax when using the MYSQL
> Update command in PHP , where I change the record by users editing the
> fields on a web form then  those are extracted to update a  record in a
> table.
> Here's what I have tried I don't get any syntax errors with either of
> these attempts
>
> $query1 = "UPDATE Qusers SET $field_str WHERE UserName='$username'";
> $result2 = mysql_query($query1);
>
>
> Second Example
>
> $query1 = "UPDATE Qusers SET BillAmt='$billamt' WHERE
> UserName='".$username."' AND Qusers.RID ='".$keyid."'";
> $result2 = mysql_query($query1);



Kory,

The PHP-db list (and archive) is full of answers to this question.
The first example looks a bit suspect unless $field_str holds a set clause in the 
form: column_name=expression,
and further that "expression" does NOT contain double quotes, eg a string value's 
delimiters.
You should precede these with several function calls to 'open' the db, and should 
follow every mysql_...() call
with an error check.
Prevailing wisdom suggests putting an echo between the two lines, so that you can see 
exactly what will be
passed as the query to MySQL.
Finally, if there is any question, that output can be copied-and-pasted into a command 
line query or a MySQL
administration tool to verify/confirm the SQL syntax.

Regards,
=dn


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to