-
-
Save andho/4166788 to your computer and use it in GitHub Desktop.
code for andho
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql = ("UPDATE schedule SET Shift_ID = '$shift' WHERE (`Date` BETWEEN '$from' AND '$to') AND (Emp_ID = '$emp_id')"); | |
if(!$result_shift_update_query = $mysqli->query($sql)) | |
{ | |
echo "INSERT ERROR 1 HERE"; | |
} | |
echo "Shift UPDATE SQL: " . $sql . "<br><br>";//error checking | |
$sql = ("SELECT `Date` FROM schedule WHERE (`Date` BETWEEN '$from' AND '$to') AND (Emp_ID = '$emp_id')"); | |
if(!$result_date_query = $mysqli->query($sql)) | |
{ | |
echo "INSERT ERROR 2 HERE"; | |
} | |
echo "SELECT SQL: " . $sql . "<br><br>";//error checking | |
while($row = $result_date_query->fetch_assoc()) | |
{ | |
echo "Date: " . $row['Date'] . "<br>";//error checking | |
$date = date('D',strtotime($row['Date'])); | |
if(in_array($date, $_POST['offdays'])) | |
{ | |
echo "MATCHED! Date: " . $date . "<br>";//error checking | |
$sql = ("UPDATE schedule SET Shift_ID = '$off' WHERE `Date` = '" . $row['Date'] . "' AND Emp_ID = '$emp_id'"); | |
if(!$result_update_offdays_query = $mysqli->query($sql)) | |
{ | |
echo "INSERT ERROR 3 HERE"; | |
} | |
echo "UPDATE DAYS OFF SQL: " . $sql . "<br><br>";//error checking | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment