Query failed! 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 'AND ativo=1 GROUP BY playerID' at line 1

Backtrace:
Array ( [0] => Array ( [file] => /home/chessman/public_html/webchess/includes/classes/Database.class.inc [line] => 78 [function] => read_query [class] => Database [object] => Database Object ( [queries:protected] => Array ( ) [read_count:protected] => 1 [write_count:protected] => 0 ) [type] => -> [args] => Array ( [0] => select p.* from logincookies as a JOIN (logincookies as b, players as p) where p.playerID = a.player_id AND a.cookie = b.cookie AND b.player_id = AND ativo=1 GROUP BY playerID [1] => [2] => 15 [3] => ) ) [1] => Array ( [file] => /home/chessman/public_html/webchess/includes/cookiecheck.php [line] => 52 [function] => query [class] => Database [object] => Database Object ( [queries:protected] => Array ( ) [read_count:protected] => 1 [write_count:protected] => 0 ) [type] => -> [args] => Array ( [0] => select p.* from logincookies as a JOIN (logincookies as b, players as p) where p.playerID = a.player_id AND a.cookie = b.cookie AND b.player_id = AND ativo=1 GROUP BY playerID ) ) [2] => Array ( [file] => /home/chessman/public_html/webchess/chess-join-game.php [line] => 21 [function] => shares_cookies_with_players [args] => Array ( [0] => ) ) )