One: Mysqli.dll is a way to manipulate the database in an object-or-process manner, and it is easy to use. Here is a comparison of several common operations with Mysql.dll.
1:mysql.dll (can be understood as a functional approach):
$conn = mysql_connect (' localhost ', ' user ', ' password '); Connecting to the MySQL database
mysql_select_db (' data_base '); Select Database
$result = mysql_query (' select * from Data_base ');//Here is a second optional parameter that specifies an open connection
$row = Mysql_fetch_row ($result))//For simplicity, only one row of data is taken here
echo $row [0]; Output the value of the first field
Mysqli also has a process-style approach, but it starts with a mysqli prefix, all the same. If Mysqli is manipulated in a procedural way, some functions must specify resources, such as mysqli_query (resource identification, SQL statement), and resource identifier parameters are placed in front, while mysql_query (SQL statement, ' optional ') resource identification is placed behind , and can be unspecified, which defaults to the last open connection or resource.
2mysqli.dll (object mode):
$conn = new mysqli (' localhost ', ' user ', ' password ', ' data_base ');
The connection here is new, and the last parameter is to specify the database directly, without mysql_select_db ().
can also be constructed without specifying, and then $conn-> select_db (' data_base ')
$result = $conn-> query (' SELECT * from Data_base ');
$row = $result-> fetch_row (); Fetch a row of data
Echo Row[0]; Output the value of the first field