SELECT wacdb_turns.id AS turnId FROM wacdb_turns WHERE wacdb_turns._season = AND wacdb_turns._kickoff <= NOW() ORDER BY wacdb_turns._kickoff DESC LIMIT 1 --- You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND wacdb_turns._kickoff <= NOW() ORDER BY wacdb_turns._kickoff DESC LIMIT 1' at line 1 ---