What is the use of the mysqli_fetch_assoc () function in PHP
This article mainly introduces what is the use of the mysqli_fetch_assoc () function in PHP. It is very detailed and has a certain reference value. Interested friends must finish reading it!
Mysqli_fetch_assoc () function
The mysqli_fetch_assoc () function can take a row from the result set and return it as an associative array, which has the following syntax format:
Mysqli_result::fetch_assoc ()
This is its object-oriented grammar format, and the following is the process-oriented grammar format:
Mysqli_fetch_assoc (mysqli_result $result)
It is important to note that mysqli_result and $result are represented as result sets obtained using the mysqli_query () function.
Next, let's take a look at the use of the mysqli_fetch_assoc () function through an example, as follows:
Output result:
From the above example, we successfully get a row of information in the database through the mysqli_fetch_assoc () function and return it as an associative array. We can also use the function to control the form of the returned data, so that it can be an indexed array, an associative array or both, so we will use the mysqli_fetch_array () function.
These are all the contents of the article "what is the use of the mysqli_fetch_assoc () function in PHP?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!