如何显示多个mysql查询的单个警报消息?

i have a small doubt.. i posted my delete.php page coding here.

if(isset($_GET["id"]))
{
    $meal_query = mysql_query("DELETE FROM ebmealplans WHERE MealPlanID = '$id'");
    echo mysql_error();
    $room_query = mysql_query("DELETE FROM ebroomtypes WHERE RoomTypeID = '$id'");
    echo mysql_error();
    $tariff_query = mysql_query("DELETE FROM ebvouchertariffs WHERE VoucherID_Fk = '$id'");
    echo mysql_error();
    $query = mysql_query("DELETE FROM ebvouchers WHERE VoucherID = '$id'");
    echo mysql_error();
    if($query)
    {
        echo "<script> alert('Voucher deleted successfully'); </script>";
    }
    else
    {
        echo "<script> alert('Failed to delete this voucher'); </script>";
    }
    mysql_close($link);
    echo "<script> location.href='managevouchers.php'; </script>";
}

here i am delete some user datas using this php coding. it worked perfectly. i created four separate tables for store the records. if deletion function was successfully completed i want to show the alert message to users "Deleted Successfully". you can see in my coding i'm just show the alert message for only one $query. i tried another method..

if($query)
{
 alert function
}
else
{
 alert function
}
if($meal_query)
{
 alert function
}
else
{
 alert function
}
if($room_query)
{
 alert function
}
else
{
 alert function
}
if($tariff_query)
{
 alert function
}
else
{
 alert function
}

it show the alert message four times. i know multiple alert functions annoying the users. my question is how to show the single alert message for mysql multiple queries?

Just store the msg pieces in some variable, and alert them all finally.

$msgs = array ();

if ($query) {
    $msgs [] = '.....';
} else {
    $msgs [] = '...';
}

if ($meal_query) {
    $msgs [] = '....';
} else {
    $msgs [] = '...';
}
//....


if ($msgs) {
    //join the msgs with line break
    $alert = join ( "
", $msgs );

    //json encode will make sure it's like "..string..", no quotes problem
    echo '<script> alert(', json_encode ( $alert ), '); </script>';
}