I have stored travel times in a database. I want to display to the users only the available travels (those who are not yet gone) according to the current time.
This is my php code, but it returns "false" as result. What am I doing wrong please?
require "conn.php";
$sql = "SELECT * FROM Horaires";
$result = mysqli_query($conn, $sql);
$temp = array();
$now = strtotime(date("h:i"));
while ($row = mysqli_fetch_array($result))
{
$temp[]=array($row['timing']);
$time = strtotime($temp);
}
if ($now >= $time)
{ echo json_encode($time, JSON_NUMERIC_CHECK); }
else { echo "There is no more travels today"; }
$conn->close();