SELECT DISTINCT(id),path,file,date_available ,tn_ext,name,filesize,storage_category_id,average_rate FROM phpwebgallery_images AS i INNER JOIN phpwebgallery_image_category AS ic ON id=ic.image_id WHERE hit > 0 ORDER BY hit DESC, file ASC LIMIT 18,-3 ; [mysql error 1064] 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 '-3' at line 7