Home > Backend Development > PHP Problem > What does php MySQLi mean?

What does php MySQLi mean?

coldplay.xixi
Release: 2023-03-01 19:50:02
Original
5221 people have browsed it

php MySQLi means: 1. mysqli is an enhanced version of the mysql system function, which is more stable, efficient and safe; 2. mysqli and mysql are both function sets in PHP; 3. mysqli is a permanent connection function , mysqli runs multiple times using the same connection process to reduce server overhead.

What does php MySQLi mean?

php MySQLi means:

1. The concept of mysqli:

 (1), mysql and mysqli are both PHP function sets and have little connection with the mysql database.

 (2). After the php5 version, the function function of mysqli has been added. In a sense, it is an enhanced version of the mysql system function, which is more stable, efficient and safe, and is similar to mysql_query () corresponds to mysqli_query(), which is object-oriented and uses objects to operate and drive the mysql database.

 (3) Before the php5 version, PHP's mysql function was generally used to drive the mysql database, such as the mysql_query() function, which is process-oriented.

2. The difference between mysql and mysqli:

 (1) Mysql is a non-persistent connection function. Mysql will open a connection process every time it is connected.

 (2). Mysqli is a permanent connection function. Running mysqli multiple times will use the same connection process, thus reducing server overhead. mysqli encapsulates some advanced operations such as transactions, and also encapsulates many available methods in the DB operation process.

3. Mysqli usage reference:

 $conn = new mysqli('localhost', 'user', 'password','data_base');  //要使用new操作符,最后一个参数是直接指定数据库
  //假如构造时候不指定,那下一句需要$conn -> select_db('data_base')实现
  $result = $conn -> query( 'select * from data_base' );
  $row = $result -> fetch_row(); //取一行数据
  echo row[0]; //输出第一个字段的值
  使用new mysqli('localhost', usenamer', 'password', 'databasename');会报错,提示如下:
  Fatal error: Class 'mysqli' not found in ...
Copy after login

Usually mysqli is not enabled because the mysqli class is not enabled by default. It needs to be changed under winphp .ini, remove the [;] before php_mysqli.dll, and mysqli must be compiled into it under Linux.

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of What does php MySQLi mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template