I am trying to get past fixtures for a football website. A user will add a fixture into the database and then I want the PHP script to return all fixtures that have a date older than or equal to today. This will then populate a drop-down to select the match and enter a score.
require 'connect-mysql.php';
$sql = $conn->query("SELECT
*
FROM
fixtures
WHERE
fixture_date <= " .date("Y-m-d"). "
ORDER BY
fixture_date DESC");
$rows = array();
while ($row = $sql->fetch_assoc()) {
$rows[] = $row;
}
echo json_encode($rows); // Parse to JSON and print.
The current output is nothing when I have database entries with a date of yesterday.
For example, I'd expect it to output a result if there was a fixture in there for today because I have put equal to also.