These two functions return an array. The difference is that the array returned by the first function only contains values. We can only $row[0],
$row[1], so use the array subscript. Read the data, and the array returned by mysql_fetch_array() contains both the first type and the form of key-value
pairs. We can read the data like this, (if the database fields are username, passwd):
$row['username'], $row['passwd']
Moreover, if you use ($row as $kay => $value) to operate, you can also directly obtain the fields of the database name.
The more important thing is that mysqli is a new function library provided by php5. (i) means improvement and its execution speed is faster.
For example:
Copy code The code is as follows:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//Connect to the local mysql database, select test as the operation library
$mysqli = mysqli_connect("localhost", "root", "","test", 3306);
//Use the mysql_query function from user Read data from the table
$result = mysqli_query($mysqli, "SELECT * FROM userinfo");
while($row = mysqli_fetch_array($result))//Read the data content through loop
{
?>
| |
php echo $row["Detail"]?> |
}
//Close the connection to the database
mysqli_free_result ($result);
mysqli_close($mysqli);*/
?>
http://www.bkjia.com/PHPjc/327342.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327342.htmlTechArticleBoth functions return an array. The difference is that the array returned by the first function only contains Value, we can only $row[0], $row[1], so we can read data using array subscripts, and my...