开发者

Best way to perform MySQL queries in PHP

开发者 https://www.devze.com 2023-02-04 13:40 出处:网络
Sorry, I\'ve forgotten an important word here. What is the most forgotten word way to perform MySQL Queries using PHP?

Sorry, I've forgotten an important word here.

What is the most forgotten word way to perform MySQL Queries using PHP?

I read somewhere, that instead of using the old mysql_connect/mysql_query() statements, we should be using something else now! And the person who wrote that made it sound like we all should have known this by now.

I'm no expert on this stuff, but I really can't find anything about this.

I just remembered the word: efficient.

Any help at all is much appreciated. Any links/tuts/articles/code examples are very welcome开发者_如何转开发. :)

Thank you!


improved mysql (myqli) or PDO ?


mysqli and PDO are recommended nowadays, mainly because they support parametrized queries which, if used properly, eliminate the risk of mySQL injection.


Nowadays most applications are developed using an ORM like doctrine or propel. Internally most of them are using PDO....


I would highly recommend using PDO over mysql_*. There are plenty of tutorials out there, e.g. this one.

0

精彩评论

暂无评论...
验证码 换一张
取 消