[英]Why is “mysql_connect” discouraged and what are the alternatives?
I'm trying to learn about database management and MySQL through PHP. 我正在尝试通过PHP了解数据库管理和MySQL。 The problem is all the tutorials I've seen use mysql_connect
and according to the documentation that's bad. 问题是所有 的 教程我见过使用mysql_connect
并根据文档这是很糟糕。 What is the problem with using mysql_*
functions and what are the alternatives? 使用mysql_*
函数有什么问题,还有哪些替代方法? If there are any free online tutorial please post the link. 如果有任何免费的在线教程,请发布链接。
You can try using mysqli
the i
stands for Improved to access to your Database and it offers a lot more functions than just the mysql
connector, or also you can use PDO
wich stands for PHP Data Objects which is the one i prefer because it will let you use more than just MySQL as a database. 您可以尝试使用mysqli
, i
代表改良版可以访问您的数据库,它提供的功能比mysql
连接器还多,或者您可以使用PDO
代表PHP数据对象 ,我更喜欢PDO
,因为它会让您您不仅将MySQL用作数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.