mysqli mysql的区别_浅谈mysql与mysqli之区别

本文探讨了MySQL和mysqli在PHP中的不同之处。mysqli作为MySQL的改进版本,提供了面向对象的接口,支持预处理语句等功能,并且能更好地利用MySQL 4.1及更高版本的功能。mysqli还支持持久连接,减少了服务器开销。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

网上搜到的一些关于mysql与mysqli的区别:

Mysql and Mysqli(Mysql Improved) are two library functions ( or Extension) in the PHP which is used to acces mysql database.Mysqli is the improved version of mysql which support OOPS. The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.

mysql是非持继连接函数而mysqli是永远连接函数。也就是说

mysql每次链接都会打开一个连接的进程而mysqli多次运行mysqli将使用同一连接进程,从而减少了服务器的开销

如 果使用new mysqli(‘localhost’, usenamer’, ‘password’, ‘databasename’);总是报错,Fatal error: Class ‘mysqli’ not found in …那么要检查一下mysqli是不是开启的。

mysqli类不是默认开启的,win下要改php.ini,去掉php_mysqli.dll前的;,linux下要把mysqli编译进去。

In relation to PHP programming language, MySQL is the old database driver, and MySQLi is the Improved driver. MySQLi takes advantage of the newer features of MySQL 5. Lifted verbatim from the php.net site:- Object-oriented interface

– Support for Prepared Statements

– Support for Multiple Statements

– Support for Transactions

– Enhanced debugging capabilities

– Embedded server support

You have the choice of using mysql, mysqli, or PDO essentially.

If you’re simply looking for a relational database, you need look no further than MySQL, though there are many options available. You can use DBD, Postgres, MySQL, MSSQL, sqlite, etc etc etc…

标签:PHP学习, PHP网站

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值