i have large table where is night and day work hour. for some reason some of the values are updated like valuex2 why?
my code:
if ($source=='editEmployeeHours') {
$object=htmlentities($_POST['object'], ENT_QUOTES, "UTF-8");
$period=htmlentities($_POST['period'], ENT_QUOTES, "UTF-8");
$m=htmlentities($_POST['m'], ENT_QUOTES, "UTF-8");
$y=htmlentities($_POST['y'], ENT_QUOTES, "UTF-8");
$date=htmlentities($_POST['date'], ENT_QUOTES, "UTF-8");
$records=htmlentities($_POST['records'], ENT_QUOTES, "UTF-8");
include('inc/s.php');
$g = null;
while ($g <= $records){
$g++;
$edithoursday = $personday = $day = null;
$edithoursday=htmlentities($_POST['edithoursday'][$g], ENT_QUOTES, "UTF-8");
$personday=htmlentities($_POST['personday'][$g], ENT_QUOTES, "UTF-8");
$day=htmlentities($_POST['day'][$g], ENT_QUOTES, "UTF-8");
if($edithoursday!=''){
$resultd = mysqli_query($conn,"SELECT * FROM timesheets WHERE day='".$day."' AND person_code = '".$personday."' AND object_id = '".$object."' AND period_code='".$period."' AND type='0'");
if (!$resultd){die("Attention! Query to show fields failed.");}
if (mysqli_num_rows($resultd)!=0){
$queryied = "UPDATE timesheets SET value='".$edithoursday."' WHERE day='".$day."' AND person_code = '".$personday."' AND object_id = '".$object."' AND period_code='".$period."' AND type='0'";
mysqli_query($conn, $queryied);
}
}
}
header("Location: "home");
die(0);
}
For updating night hours i have same code but with nights variables Is there anything wrong that i do not see?
My apologize for long code!