I am creating a Php application of exam where i want to stop exam in 1 hour
I send test start time and end time in database code of inserting time in db
<?php $date = date('h-i-sa');
$date1 = date('h-i-sa',strtotime('+5 min'));
$sql = "insert into timer(name,start_time,end_time) values('$name','$date','$date1')"; ?>
now i fatch this time by fatch query
<?php $sel = "select * from timer where id=28";
$ex1=$conn->query($sel);
$r=$ex1->fetch_object(); ?>
Now I got
exam start time = <?php $s_time = echo $r->start_time; ?>
Exam end time = <?php $e_time = echo $r->end_time; ?>
and
Latest Time = <?php
date_default_timezone_set("Asia/Kolkata");
$l_time = echo date('h-i-sa');
?>
Now i need difference between End time & Latest time means $l_time & $e_time
i wrote following code , but its not working
<?php
if($l_time == $e_time)
{
echo 'time over';
echo "<script>alert('time over'); </script>";
return 'index.php';
}
?>