As the title says, do I have to escape user input when using bind_param() or is that done internally?
Thank you.
No, you do not need to escape data to protect against SQL injection when binding parameters.
This does not absolve you from validating said data though.
When binding parameters, there is no escaping performed (internally or otherwise). An SQL statement is prepared with parameter placeholders and values for these are passed at execution time.
The database knows what parameters are and treats them accordingly as opposed to SQL value interpolation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With