Originally posted by ahundiak
You can also use a cast which will force the input to be integer regardless.
$id = (integer)$_GET('id');
Strings will just end up setting $id to 0.
0 (zero) wouldn't be good, cause $id point to an id in database, so there's no id #0.
OK, how about this:
if (!empty($GET[id]) && is_int($GET[id]) && !ereg(".-", $_GET[id]))
will those safe?
I also see an example in PHP manual to pull out from database, the manual writer uses this coding style:
$sql = printf("SELECT * FROM table");
what the printf uses for?