I have this code to update, from multiple select boxes. I does not work can anyone tell me what I am doing wrong.
Here is the query:
$select_make = $_POST['select_make'];
$select_model = $_POST['select_model'];
$select_year = $_POST['select_year'];
$select_city = $_POST['select_city'];
$select_state = $_POST['select_state'];
$select_zip = $_POST['select_zip'];
$MAKE = implode("','",$_POST['MAKE']);
$MODEL = implode("','",$_POST['MODEL']);
$YEAR = implode("','",$_POST['YEAR']);
$CITY = implode("','",$_POST['CITY']);
$STATE = implode("','",$_POST['STATE']);
$ZIP = implode("','",$_POST['ZIP']);
$query = "UPDATE $catagory$subcatagory SET ACTIVE='1' WHERE MAKE = '('".$MAKE."')";
if($select_model =='1'){
$query.=" AND MODEL IN ('".$MODEL."')";
}
if($select_year =='1'){
$query.=" AND YEAR IN ('".$YEAR."')";
}
if($select_city =='1'){
$query.=" AND CITY IN ('".$CITY."')";
}
if($select_state =='1'){
$query.=" AND STATE IN ('".$STATE."')";
}
if($select_zip =='1'){
$query.=" AND ZIP IN ('".$ZIP."')";
}
$result = mysql_query($query) or die(mysql_error());
print "Thank you information updated!\n";
print "<meta http-equiv=\"refresh\" content=\"1; URL=sort.php?subcatagory=RECOMMEND\">";
Here is the error.
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 'CADILLAC','CHEVROLET') AND CITY IN ('ABERCROMBIE','ABERDEEN','A
Thanks in advance.