Link to home
Start Free TrialLog in
Avatar of fcruz5
fcruz5Flag for United States of America

asked on

Update & Delete from multiple tables in PHP?

How do I update & delete from multiple tables in one query? What is the best way to do this?

Lets say I want to DELETE from table1, table2, table3, table4

and

UPDATE fields 1-5 on both table5 & table6
<?php
require('db.php');
 
mysql_query("DELETE FROM table1");
 
mysql_query("UPDATE table5 SET field1='', field2='', field3='', field4='', field5='' ");
 
mysql_close();
exit();
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Khanh Doan
Khanh Doan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial