Xtremer360 Posted February 17, 2009 Share Posted February 17, 2009 What I'm trying do in in the delete country in addition to the deleting country from the countries table I also need to have it go to the arenas table and have it find all the records that have the same country name as the one that's being deleted. //Form was submitted - determine the form if ( isset ( $_POST['deletecountry'] ) ) { $country = mysql_real_escape_string($_POST['country']); $query = "DELETE FROM countries WHERE `country` = '".$country."' LIMIT 1"; // Execute the query. // Good. This error checking method is recommended. if (@mysql_query ( $query )) { print '<p>The country has been deleted.</p>'; } else { print '<p>Could not delete the entry because: <b>"' . mysql_error() . '"</b>. The query was '.$query.'.</p>'; } //mysql_close (); } else if ( isset ( $_POST['editcountry'] ) ) { // Define the query. $country = mysql_real_escape_string($_POST['country']); $oldcountry = mysql_real_escape_string($_POST['oldcountry']); $query = "UPDATE countries SET country = '$country' WHERE country = '$oldcountry'"; // Execute the query. // Good. This error checking method is recommended. if (@mysql_query ( $query )) { print '<p>The country has been edited.</p>'; } else { print '<p>Could not edit the entry because: <b>"' . mysql_error() . '"</b>. The query was '.$query.'.</p>'; } //mysql_close (); } Link to comment https://forums.phpfreaks.com/topic/145513-solved-multiple-delete-query-to-different-tables/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.