I have a query like this:
SELECT name FROM mytable WHERE id = $id
where $id is given from user.
I do add slashed for input variable.
Is it enough to only use (int)$id to prevent SQL injection? Or do I have to check $id with is_numeric before passing it to the query?
Edited: the script language is PHP.
$value = $id + 0and then pass$valueto the query. Anything to ensure that the user's raw data is not treated like a string when you want it to be a number.