Earlier today a question was asked regarding input validation strategies in web apps.
The top answer, at time of writing, suggests in PHP
just using
$result = "SELECT fields FROM table WHERE id = ".(INT) $_GET['id'];
Works well, even better on 64 bit systems. Beware of your systems limitations on addressing large numbers though, but for database ids this works great 99% of the time.
You should be using a single function/method for cleaning your values as well. Even if this function is just a wrapper for mysql_real_escape_string(). Why? Because one day when an exploit to your preferred method of cleaning data is found you only have to update it one place, rather than a system-wide find and replace.