SELECT COUNT(*) AS redcards FROM wacdb_livematches WHERE wacdb_livematches._club = AND wacdb_livematches._match = 221063 AND wacdb_livematches._action = 'redcard' --- 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_livematches._match = 221063 AND wacdb_livematches._action = 'redcard'' at line 1 ---