MySQL Forums
Forum List  »  Newbie

AND causing problems with UPDATE
Posted by: David Coombes
Date: September 06, 2004 10:30AM

i'm trying to update a table based on two values with php.
mysq sytax is as follows:

if(mysql_query("UPDATE sub_counties SET child='".$value2."' WHERE parent='".$parent."' AND child='".$value1."'"))
{
do something
}else{
log mysql_error() into a table
}

this works and updates the table but it creates an error. i presume the problem is a small one so i replaced AND with && and am still getting the same problem. the error is:

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 $value2 at line 1.

i need to make sure that column parent='$parent' and child='$value1',
can anyone help,
cheers,
Coombes

Options: ReplyQuote


Subject
Written By
Posted
AND causing problems with UPDATE
September 06, 2004 10:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.