Several methods of mysqli processing query result sets in php, mysqli query results
Recently, I have checked the information in the places where I don’t understand several methods of php query mysql processing result set, and I will record it here.
PHP uses the mysqli_result class to process result sets in the following ways
function | describe |
---|---|
fetch_all() | Fetch all result rows and return the result set as associated data, numerically indexed arrays, or both |
fetch_array() | Fetch a row of results as an associative array, numerically indexed array, or both |
fetch_object() | Returns the current row of the result set as an object |
fetch_row() | Returns a row of results as an enumerated array |
fetch_assoc() | Fetch a row of results as an associative array |
fetch_field_direct() | Returns the metadata of a single field in the result set as an object |
fetch_field() | Returns the column information in the result set as an object |
fetch_fields() | Returns the column information in the result set as an array of objects |
fetch_all (fetch all rows from the result set as an associative array)
$sql = "select * from user" ; $result = $link - > query ( $sql )
…
The post PHP mysqli Several ways to query a database first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9063
This site is for inclusion only, and the copyright belongs to the original author.