i would like to ask .
I'm trying to add TIME value into mysql database .But the value added in database is 838:59:59
And it only store into timein column as 838:59:59. Timeout column result is 00:00:00 value.
The code as below
<?php
$connect = mysqli_connect("localhost", "root", "root", "database");
global $connect;
if(isset($_POST['Submit']))
{
$timeout = strtotime('08:30:00');
$timein = strtotime('12:30:00');
$time_out_user = strtotime($_POST['timeout']);
$time_in_user = strtotime($_POST['timein']);
if(($time_out_user >= $timeout) && ($time_out_user <= $timein))
{
echo "Duplicate time";
}
else
{
$add = "INSERT INTO table (timeout,timein)
VALUES ('$time_out_user','$time_in_user')";
$addDateTime = mysqli_query($connect,$add);
echo "Time added";
}
}
?>
<form action="test.php" method="post">
<table>
<tr>
<td><i class="fa fa-unlock-alt"></i> </td>
<td>Time Out: </td>
<td><input type ="time" name="timeout" size="30"></td>
</tr>
<tr>
<td><i class="fa fa-unlock-alt"></i> </td>
<td>Time In: </td>
<td><input type ="time" name="timein" size="30"></td>
</tr>
</table>
<p><input class="btnSuccess" type ="submit" name="Submit" value="Submit"> </p>
</form>
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…