Query SELECT relaz_file_cartelle.* FROM relaz_file_cartelle, file_cartelle WHERE file_cartelle.comparto = 292 AND file_cartelle.c_s = 2 AND file_cartelle.id = relaz_file_cartelle.id_file AND relaz_file_cartelle.id_cartella = 0 ORDER BY posiz ASC LIMIT -20,20: 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 '-20,20' at line 1