O people, I am learning PHP and I am looking at PDO - one thing that I am not clear though, is that I should use the statement made of PDO with the function or just by myself. For example, let me know
$ query = $ database-> connection-> ("SELECT name from WHERE id =: id LIMIT 1"); $ Query-> Binamparam (": id", $ id-> id, PDO :: PARAM_INT);
Or something like this?
$ id = filter_var ($ this-> ID, FILTER_VALIDATE_INT); $ Query = $ Database-> Connection- & gt; Prepare ("Choose name FROM number WHERE id =: id LIMIT 1"); $ Query-> Bind Parm (": id", $ id, PDO :: PARAM_INT); Generally it is speaking for various tasks.
You can validate your data according to your wishes.
.
But PDO does not require any recognition.
For the code provided by you, it is unnecessary to use filter_var (), because the BindPem :: ParamitT flag with the PDO will do the same work
Comments
Post a Comment