Hi ALL Can anyone help me on this query please, all I'm trying to do is Update three tables in a same query. if($_POST['submit']) { foreach($_POST as $job_id) { mysql_query("UPDATE job_tb,blockbook,blockbook2 SET job_tb.cust_address = 'Cancel' blockbook.cust_address = 'Cancel' blockbook2.cust_address1 = 'Cancel' WHERE job_tb.job_id = '$job_id' AND blockbook.job_id = '$job_id' AND blockbook2.job_id = '$job_id'"); if (mysql_affected_rows() > 0) { // execute query print "<font color=red size=2> No. = $job_id has been Updated</font><p>"; } } } Code (markup): Thanks Zed
I've never update 3 tables at a time so i do not know if the syntax is correct. try doing web search about it
This is error message I'm getting 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 'blockbook.cust_address = 'Cancel' blockbook2.cust_address1 = 'Cancel' W' at line 3 But I still can not see anything wrong with syntax, Please help!!! Thanks Zed
like java said. Use mysql join function. I think i saw some topics about that when i did a web search just now
UPDATE job_tb,blockbook,blockbook2 SET job_tb.cust_address = 'Cancel' , blockbook.cust_address = 'Cancel', blockbook2.cust_address1 = 'Cancel' WHERE job_tb.job_id = '$job_id' AND blockbook.job_id = '$job_id' AND blockbook2.job_id = '$job_id'" You are missing the , coma between the update variables.