PHP access to query MySQL data commonly used three ways:
1. $row = Mysql_fetch_row ($result);
Returns an array of rules $row, $row [0] is the first element, $row [1] is the second element, and so on ...
Mysql_num_fields ($result) returns the number of elements of the result.
2. $row = Mysql_fetch_array ($result);
Returns an array of $row. Examples are as follows:
The table structure is as follows:
Username | PassWord
-------------------------------------
Bourbon | Abc
Berber | Efg
The first run $row = mysql_fetch_array ($result) results in the following:
$row [0] = $row ["username"] = "Bourbon"
$row [1] = $row ["password"] = "abc"
The first run $row = mysql_fetch_array ($result) results in the following:
$row [0] = $row ["username"] = "Berber"
$row [1] = $row ["password"] = "EFG"
3. $row = Mysql_fetch_object ($result);
Returns an object description row. As in the above example
The first run of run $row = mysql_fetch_object ($result) results in the following:
$row->username = "Bourbon"
$row->password = "abc"
The second run of run $row = mysql_fetch_object ($result) results in the following:
$row->username = "Berber"
$row->password = "EFG"
The above describes the PHP access to query MySQL data commonly used three methods, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.