I want to get matches played between 2 certain dates. In MySQL terminal, I hardcoded the following query and got the following rows returned (to check whether my query is correct)
QUERY
SELECT *
FROM schedule
WHERE gameDateTime BETWEEN '2020-02-21 00:00:00'
AND '2020-02-25 15:15:00'
HOWEVER, when I run this simple query through PHP I get NO results
PHP CODE
$sql = "SELECT * FROM `schedule` WHERE `gameDateTime` BETWEEN '2020-02-21 00:00:00' AND '2020-02-25 15:15:00'";
$stmnt = $db->prepare($sql);
$games = $stmnt->fetchAll();
foreach ($games as $game){
echo $game['homeTeam'];
echo 'VS';
echo $game['awayTeam'];
echo '<hr />';
}
DEBUGGING
- I DID a select(*) to ensure I can retrieve data from my DB
- gameDateTime IS a datetiime() column
Help appreciated