If you don't have time to rewrite your queries using prepared statements, I would say I'd have more confidence in casting the user input.
$id = (int) $_GET['id'];
Since this variable is now an int
, there is no way it can contain malicious input. Of course, you should still do any necessary range validation on it (e.g. if negative numbers should be disallowed).
I've assumed this column is an integer, but (float)
can be used in the same way here, for data that is numeric but not integer.
For the avoidance of doubt, parameter binding is still the best approach to injecting user input into your queries. My answer here is intended to answer the thrust of the question directly i.e. is there a way to make queries safe without binding? The answer above shows that the answer is yes.