hi can someone help me..i need to delete data in two tables at the same time..here is my sql code..it won't work..thank you
$data = $_POST['data'];
mysql_query("DELETE FROM table1 WHERE column='$data'; DELETE FROM table2 WHERE column='$data'")
Delete data in two tables at the same time
Moderator: General Moderators
Re: Delete data in two tables at the same time
You can't execute more than one query at a time by using standard mysql_* functions.
You have to call mysql_query twice.
Also, you may find http://bg2.php.net/manual/en/mysqli.multi-query.php useful.
And finally - you may find MySQL innoDB TRIGGERS useful too.
http://dev.mysql.com/doc/refman/5.0/en/triggers.html
You have to call mysql_query twice.
Also, you may find http://bg2.php.net/manual/en/mysqli.multi-query.php useful.
And finally - you may find MySQL innoDB TRIGGERS useful too.
http://dev.mysql.com/doc/refman/5.0/en/triggers.html
There are 10 types of people in this world, those who understand binary and those who don't
Re: Delete data in two tables at the same time
thank you..it's working now..VladSun wrote:You can't execute more than one query at a time by using standard mysql_* functions.
You have to call mysql_query twice.
Also, you may find http://bg2.php.net/manual/en/mysqli.multi-query.php useful.
And finally - you may find MySQL innoDB TRIGGERS useful too.
http://dev.mysql.com/doc/refman/5.0/en/triggers.html