The first query works and displays the proper results. When I add an additional AND condition I get a "Trying to get property of a non-object" error.
I can successfully execute with one OR and one other condition.
Here is the query echoed:
SELECT * FROM scores
WHERE (sortDate <= 20190629 AND sport = football)
AND (homeID = 4 OR awayID = 4)
ORDER BY gameDate DESC
I'm sure the variable are passing through.
This one works fine:
$sql = "SELECT * FROM scores
WHERE sortDate <= $today
AND (homeID = $teamID OR awayID = $teamID)
ORDER BY gameDate DESC";
This one gives an error (added AND):
$sql = "SELECT * FROM scores
WHERE (sortDate <= $today AND sport = $sportID)
AND (homeID = $teamID OR awayID = $teamID)
ORDER BY gameDate DESC";