Can I write prepared statements in procedural style?

只谈情不闲聊 提交于 2020-04-06 02:18:31

问题


The example from the PHP manual is using OOP. Is there a way to do it procedurally?


回答1:


MySQLi has procedural-style function calls that can handle prepared statements. (Some of the procedural-style functions are deprecated, however.)

http://us.php.net/manual/en/mysqli-stmt.prepare.php




回答2:


Yes, you can. As far as I know PDO is completely object-oriented, but you may want to look into mysqli which allows both procedural and OO styles.

Procedural coders will find the basics almost identical. Where before you would used a function such as mysql_connect(), the new function is simply mysqli_connect(). Most of the old mysql_x functions have equivalent mysqli_x versions.

Source



来源:https://stackoverflow.com/questions/2869748/can-i-write-prepared-statements-in-procedural-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!