为什么“ mysql_connect”灰心丧气,还有什么选择? [英] Why is "mysql_connect" discouraged and what are the alternatives?
问题描述
我正在尝试通过PHP了解数据库管理和MySQL。问题是全部 教程我见过使用 mysql_connect
并根据文档认为这很糟糕。使用 mysql _ *
函数有什么问题,还有哪些替代方法?如果有免费的在线教程,请发布链接。
I'm trying to learn about database management and MySQL through PHP. The problem is all the tutorials I've seen use mysql_connect
and according to the documentation that's bad. What is the problem with using mysql_*
functions and what are the alternatives? If there are any free online tutorial please post the link.
推荐答案
您可以尝试使用 mysqli
i
表示 Improved 可以访问您的数据库,它提供的功能远远超过 mysql
连接器,或者也可以使用 PDO
来表示 PHP数据对象,这是我更喜欢的一个,因为它不仅可以让您将 MySQL 用作数据库。
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.
这篇关于为什么“ mysql_connect”灰心丧气,还有什么选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!