You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'or team_id2=) and confirm=1 order by bdate desc limit 1,1' at line 1select bdate from tb_score where (team_id1= or team_id2=) and confirm=1 order by bdate desc limit 1,1