...

View Full Version : query syntax error?



chump2877
06-26-2005, 12:51 PM
For this line of code:


$queryW = "UPDATE customer_dbase SET " . $column . "=" . $update . " WHERE index_no LIKE '%" . $ref_no . "%'";
$resultW = mysql_query($queryW);
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}

I get the following SQL error:


1064: 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 'WHERE index_no LIKE '%3%'' at line 1

anyone see the problem? thanks.

SeeIT Solutions
06-26-2005, 01:11 PM
Try using


$queryW = "UPDATE customer_dbase SET " . $column . "=" . $update . " WHERE index_no = '" . $ref_no . "';";

Kid Charming
06-26-2005, 05:23 PM
Something's wrong with your $update variable -- it may not be set correctly, or if it's a string, it needs to have single quotes around it like $ref_no.

chump2877
06-26-2005, 10:57 PM
Something's wrong with your $update variable -- it may not be set correctly, or if it's a string, it needs to have single quotes around it like $ref_no.


$update is a string, so you were exactly right about having single quotes around it....thanks! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum