I have this code within a PHP page, however it doesn't give me what I want - logically, it is correct (I think!) but it's starting to bug the hell out of me...
What I'm trying to do is display games before a specified date and time - these values are held within the MySQL database.
$dateNow = date("Y\-m\-d");
$timeNow = date("H:m:s");
dbCon(); //initiate the database connection
$sql = "SELECT
h.teamName 'homeTeamName',
a.teamName 'awayTeamName',
h.venue,
g.dateOfGame,
g.timeOfGame,
g.ID
FROM games g
LEFT JOIN teams h ON g.homeTeam = h.ID
LEFT JOIN teams a ON g.awayTeam = a.ID
WHERE g.dateOfGame <= '".$dateNow."' AND g.timeOfGame < '".$timeNow."'
ORDER BY g.dateOfGame, g.timeOfGame ASC LIMIT 3;"
Many thanks in advance