Avatar of fcruz5
fcruz5
Flag 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

PHP

Avatar of undefined
Last Comment
Michael701

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Khanh Doan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Michael701

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck