I have the following code :
$req = mysql_query("SELECT * FROM table WHERE id='".mysql_real_escape_string($id)."' ORDER BY lastupdate DESC LIMIT ".mysql_real_escape_string($_GET['start']).", 15 ");
For some reason it seems like I can inject some (unusable) SQL code into the $_GET['start'] parameter.
For example : 1,100 #
(url encoded like this : +1%2C+100%23
)
I'm fairly sure you can't really use it to do any damage or steal anything from my db (UNION can't work because of ORDER BY, and mysql_query() doesn't allow multiple queries
I know I should add intval() to make sure it is an integer. My main question is WHY... Why does it work? I really don't understand.
Thank you very much for your insights.