There is also sql injections when magic quotes are off. Maybe you tested with them on . Example: view.php?gallery_id=83' Result: View Images in: A database error has occured. mySQL said: 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 ''83'' AND publish=1 order by id asc , id asc LIMIT 0, 12' at line 1 SQL query: select id, title, thumbname, added from snipe_gallery_data where cat_id='83'' AND publish=1 order by id asc , id asc LIMIT 0, 12 Example 2: image.php?page=1&gallery_id=845&image_id=20'90 Result: TestGallery - Error Getting Image A database error has occured. mySQL said: 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 '90' AND publish=1' at line 1 SQL query: select filename, thumbname, img_date, title, details, author, location, cat_id, keywords, publish, added from snipe_gallery_data where id='20'90' AND publish=1 Thats just two things you missed but there are many more.