You have an error in your SQL syntax near 'AND valid1=1 AND valid2=1 ORDER BY rang DESC' at line 1