dI look for a date stored in the database. I save the result in a var but when I try to use that var later it gives me an error. I do not understand. How can I compare the present time with a time stored?
I look for a date that is saved in MySql database. It is saved as hours and minutes. I echo it and it works:
$result = mysqli_query($con, 'SELECT * FROM consulta WHERE id=3 AND client=1'); while ($row = mysqli_fetch_array($result)) { $begin = $row["inici"]; echo $begin; }
(this gives me: 15:30:00)
I see what is the time, now. I echo it and it works:
$time = date('H:i:s'); echo $time;
(this gives me the present time in this format: 16:38:57 )
I compare the two. It does not work. It gives me an error:
Notice: Undefined variable: begin in /Applications/MAMP/htdocs/trobadaVirtual/begin.php on line 55if ($time = $begin) { //do something }