These two functions return an array, the difference is that the first function returns an array that contains only the values, we can only $row[0],
$row [1], which reads the data as an array subscript, and the array returned by Mysql_fetch_array () contains both the first and key values
In the right form, we can read the data in this way (if the database field is USERNAME,PASSWD):
$row [' username '], $row [' passwd ']
Furthermore, if you use ($row as $kay + $value), you also get the field name of the database directly.
More important is that mysqli is a new library of functions provided by PHP5, (i) for improvement, and for faster execution.
For example:
Copy CodeThe code is as follows:
Code highlighting produced by Actipro Codehighlighter (freeware) http://www.codehighlighter.com/--> Connect to the local MySQL database and select test as the action library
$mysqli = Mysqli_connect ("localhost", "root", "" "," Test ", 3306);
Using the Mysql_query function to read data from the user table
$result = Mysqli_query ($mysqli, "select * from UserInfo");
while ($row = Mysqli_fetch_array ($result))//Read data contents by loop
{
?>
}
To close a connection to a database
Mysqli_free_result ($result);
Mysqli_close ($MYSQLI); * *
?>
http://www.bkjia.com/PHPjc/327342.html www.bkjia.com true http://www.bkjia.com/PHPjc/327342.html techarticle Both functions return an array, the difference is that the first function returns an array that contains only the values, we can only $row[0], $row [1], so that the array subscript to read the data, and my ...