Do I Need To Use (int)$id Before I Use $id In Bindvalue In Php Pdo
I just started using Php Data Objects and one thing I'm not sure about is do I have to validate that some variable is an integer before using it in the query. For example, like thi
Solution 1:
No it's not required for two reasons:
You're letting PDO know that you are going to query the database for a column ID. PDO isn't going to parse anything in
$_POST['id'].The second value of
bindValueis automatically casted to a string (or of any type you might want to select). Hereint $data_type = PDO::PARAM_STR
Post a Comment for "Do I Need To Use (int)$id Before I Use $id In Bindvalue In Php Pdo"