I have a code here that I use and whenever I run it, It runs without error but it does not update the values inside Mysql.
Kindly advice what's wrong.
Thanks.
Here's the code.
<?php
session_start();
$loginuser = $_SESSION['result'];
$con=mysqli_connect("localhost","root","","leavecalendar");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ('$_POST[department]' == 'Shared') {
//$sql="UPDATE `employee` SET `leavecount` = '$_POST[lbalance]', sickleave = 1 WHERE `department` = '$_POST[department]'";
$sql = "UPDATE `employee` SET `leavecount` = 6.44, sickleave = 5 WHERE `department` = \'Shared\'";
echo ($sql);
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
}
header("location:manageemployeeleaves.php");
mysqli_close($con);
?>
$_POSTon if('$_POST[department]' == 'Shared')