Hi Everyone,
I have an issue with processing a php form. The values seleted are suppose to correspond with the fields in an items table. There are 4 values that are passed as a form variable, but an error comes back: 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 'AND subcat3_id = 4 AND cat_id = 13' at line 1
The code is as follows:
Am I in the right forum or would I be better in php forum?
I have an issue with processing a php form. The values seleted are suppose to correspond with the fields in an items table. There are 4 values that are passed as a form variable, but an error comes back: 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 'AND subcat3_id = 4 AND cat_id = 13' at line 1
The code is as follows:
Code:
mysql_select_db($database_vacuumshop, $vacuumshop);
$query_items = sprintf("SELECT * FROM items WHERE subcat_id = %s AND subcat2_id = %s AND subcat3_id = %s AND cat_id = %s",
$subcat_items,$subcat2_items,$subcat3_items, $subcat4_items);
$items = mysql_query($query_items, $vacuumshop) or die(mysql_error());
$row_items = mysql_fetch_assoc($items);
$totalRows_items = mysql_num_rows($items);
Am I in the right forum or would I be better in php forum?