This article is mainly to share with you several MySQL query results converted to PHP array method, mainly in the form of text and we share, hope to help everyone.
$result = Mysql_fetch_row (): This function returns an array of numbers as subscripts, which you can only refer to in the form of $result[0], $Result [2].
$result = Mysql_fetch_assoc (): This function returns an array with the field name subscript, which can only be referenced by the field name.
$result [' field1 ']. $result = Mysql_fetch_array (): This function returns a mixed array, which can be referenced either by a numeric subscript or by a field name.
$result [0] or $result["field1"]. $result = Mysql_fetch_object (): Returns the result as an object, which can be referenced in the form of $result->field1.
It is recommended to use MYSQL_FETCH_ASSOC () or mysql_fetch_array, which performs faster and can also be referenced by field names, which is relatively clear.