I don't think you can delete multiple tables in a single query. But you could do this:
$aryTables = array('Table1','Table2','Table3','Table4');
$aryKeysFields = array('Table1' => 'Key1','Table2'=>'Key2','Table3'=>'Key3','Table4'=>'Key4');
foreach($aryTables as $curTable) {
$sql = "SELECT COUNT(" . $aryKeyFields[$curTable] . ") FROM $curTable WHERE " . $aryKeyFields[$curTable] . "=$item";
$numToDelete = mysql_num_rows(mysql_query($sql),0,0);
if($numToDelete < 0) {
$sql = "DELETE FROM $curTable WHERE " . $aryKeyFields[$curTable] . "=" . $item";
if(mysql_query($sql)) {
echo "$numToDelete records deleted from $curTable";
} else {
echo "$numToDelete records mathed in table $curTable, but could not be deleted: " . mysql_error() . "<br />";
} //end if
} else {
echo "No matching records found in $curTable";
} //end if
} //end foreach
Now if you want this really robust you'll store the table and field names in the database with a third field that allows you to specify the parent table and then you can modify this code to be a cascading delete.