Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind SQL variables in PHP?

I want to bind variables instead of just building SQL strings. Anyway to do this in Php?

Either MySQL or PostgreSQL answers would help.

Thanks

like image 725
Robert Gould Avatar asked Feb 05 '26 19:02

Robert Gould


2 Answers

There's e.g. PDO.
An introduction to pdo and prepared statements (including bound parameters) is located at http://docs.php.net/pdo.prepared-statements

like image 139
VolkerK Avatar answered Feb 07 '26 09:02

VolkerK


You should read on the MySQL Improved Extension (MySQLi) at http://php.net/manual/en/book.mysqli.php , and on prepared statements

like image 29
sp. Avatar answered Feb 07 '26 09:02

sp.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!