第一个查询有效并显示正确的结果。当我添加额外的 AND 条件时,我收到“试图获取非对象的属性”错误。
我可以在一个 OR 和另一个条件下成功执行。
这是回显的查询:
SELECT * FROM scores
WHERE (sortDate <= 20190629 AND sport = football)
AND (homeID = 4 OR awayID = 4)
ORDER BY gameDate DESC
我确定变量正在通过。
这个工作正常:
$sql = "SELECT * FROM scores
WHERE sortDate <= $today
AND (homeID = $teamID OR awayID = $teamID)
ORDER BY gameDate DESC";
这个给出了一个错误(添加了 AND):
$sql = "SELECT * FROM scores
WHERE (sortDate <= $today AND sport = $sportID)
AND (homeID = $teamID OR awayID = $teamID)
ORDER BY gameDate DESC";
狐的传说