-
-
Save andho/4167013 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
<?php | |
if(isset($_POST['submit'])) | |
{ | |
if(isset($_POST['offdays'])) | |
{ | |
//$off is set through the config settings// | |
$shift = $_POST['shift']; | |
$from = $_POST['from']; | |
$to = $_POST['to']; | |
$emp_id = $_POST['emp_id']; | |
$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 | |
foreach ($_POST['offdays'] as $offday) | |
{ | |
$sql = ("UPDATE schedule SET Shift_ID = '$off' WHERE (`Date` BETWEEN '$from' AND '$to') AND (Emp_ID = '$emp_id') AND (DATE_FORMAT(`Date`, '%a') = '$offday')"); | |
if (false !=== ($result_update_offdays_query = $mysqli->query($sql))) | |
{ | |
echo "UPDATE DAYS OFF SQL: " . $sql . "<br><br>";//error checking | |
} else { | |
echo "INSERT ERROR 3 HERE"; | |
} | |
} | |
$mysqli->commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment