mardi 31 mars 2015

How to run 2 sql queries in one php if statement?

This is the code i have so far



if (isset($_POST['button1']))
{
$sql = "DELETE FROM UpcomingRota";
$E1 = $_POST["MondayAMFirstEmployee"]; $E2 = $_POST["MondayAMSecondEmployee"]; $E3 = $_POST["MondayAMThirdEmployee"];
$sql = "INSERT INTO UpcomingRota (DayAndTime, FirstEmployee, SecondEmployee, ThirdEmployee) VALUES ('MondayAM', '$E1', '$E2', '$E3')";

}


Both the $sql statements work perfectly on there own but when i have both in the if statement it seems to bypass the first one and just run the last $sql statement.


How can i get it to run as many $sql statements as i need it to.... going to have around 15 - 20 in there.


Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire