简体   繁体   English

在PHP中执行MySQL查询的最佳方法

[英]Best way to perform MySQL queries in PHP

Sorry, I've forgotten an important word here. 抱歉,我在这里忘记了一个重要的字眼。

What is the most forgotten word way to perform MySQL Queries using PHP? 使用PHP执行MySQL查询时最被遗忘的单词方法是什么?

I read somewhere , that instead of using the old mysql_connect/mysql_query() statements, we should be using something else now! 我在某处读到,而不是使用旧的mysql_connect / mysql_query()语句,现在应该使用其他东西! 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. 非常欢迎任何链接/ tut /文章/代码示例。 :) :)

Thank you! 谢谢!

改进的mysql(myqli)或PDO?

如今,建议使用mysqliPDO ,主要是因为它们支持参数化查询,如果使用得当,可以消除mySQL注入的风险。

Nowadays most applications are developed using an ORM like doctrine or propel. 如今,大多数应用程序都是使用ORM(如学说或Propel)开发的。 Internally most of them are using PDO.... 内部大多数人都在使用PDO。

I would highly recommend using PDO over mysql_* . 我强烈建议通过mysql_*使用PDO There are plenty of tutorials out there, eg this one . 有很多教程,例如教程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM