PHPize Online / SQLize Online  /  SQLtest Online

Share      Blog   Popular


Tags: PHP 5.x PHP 7.x PHP 8.x

mysqli_fetch_assoc — Fetch a result row as an associative array.


    mysqli_result $result
): array|null|false
Returns an associative array that corresponds to the fetched row or null if there are no more rows.

Note: Field names returned by this function are case-sensitive.

Note: This function sets NULL fields to the PHP null value.


Procedural style only: A mysqli_result object returned by mysqli_query(), mysqli_store_result(), mysqli_use_result() or mysqli_stmt_get_result().

Return Values

Returns an associative array of values representing the fetched row in the result set, where each key in the array represents the name of one of the result set's columns or null if there are no more rows in result set. If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the same name, you either need to access the result with numeric indices by using mysqli_fetch_row() or add alias names.