Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of the mysqli_fetch_all () function in PHP

Shulou Source: shulou.com Published: 2022-06-01 02:59:17 10月30日 Update

This article is about the usefulness of the mysqli_fetch_all () function in PHP. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Mysqli_fetch_all () function

The mysqli_fetch_all () function takes all the data in the result set and returns it in the form of an associative array, an indexed array, or both, depending on the parameters. Its syntax format is as follows:

Mysqli_result::fetch_all ([int $resulttype = MYSQLI_NUM])

This is an object-oriented approach, and here is a process-oriented approach:

Mysqli_fetch_all (mysqli_result $result [, int $resulttype = MYSQLI_NUM])

It should be noted that the syntax is the same as the mysqli_fetch_array () function.

Mysqli_result and $result are represented as the result set obtained using the mysqli_query () function.

Resulttype is an optional parameter, which is a constant that sets the type of return value, which can be MYSQLI_ASSOC, MYSQLI_NUM, or MYSQLI_BOTH that represents a different type of return value.

Next, let's take a look at the use of the mysqli_fetch_all () function through an example, as follows:

Output result:

Thank you for reading! This is the end of the article on "what is the use of the mysqli_fetch_all () function in PHP?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Functions results content writing parameters data arrays more examples articles types statements syntax different good practical same and then objects constants Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi OPPO Reno NVidia macOS Huawei