Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE Problem...

Status
Not open for further replies.

PaulinKC

Programmer
Apr 2, 2002
50
US
When issuing the following UPDATE cmd, it never updates, nor does it give me an error message... am I missing something?

$query = "UPDATE tblCustomers SET (companyName = '$companyName' AND customerEmailAddress = '$customerEmail' AND customerPhoneNum = '$customerPhonNum' AND customerFaxNum = '$customerFaxNum' AND customerAddress1 = '$customerAddress1' AND customerAddress2 = '$customerAddress2' AND customerCity = '$customerCity' AND customerState = '$customerState' AND customerZipCode = '$customerZipCode') WHERE custID = '$customerID'";

I echo'd the result and everything was there, it just doesn't update the mysql database. Any ideas?
 
Your query is malformed. As the MySQL manual states ( the column assignmens in an up date are separated by commas.

To the best of my knowledge, AND is only used in a sence of a logical operator.

But if you're not getting errors, it's because you're not trapping them.

Judging by your variable names, I'm assuming that you're using PHP. In that case, when you issue the mysql_query() statement, it should be accompanied with a error trap:

$result = mysql_query ($query) or die(mysql_error());



Want the best answers? Ask the best questions: TANSTAAFL!!
 
Thanks for your help, after using the mysql_error() I found what the problem was... SET companyName = '$companyName', customerEmailAddress = '$customerEmailAddress' was the solution, not what I had before... thanks again for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top