Access to fetch results via MySQL fetch array

MySQL fetch array processes the results of fetching from the database and returns as a result a regular, associative or both arrays at once. In fact, MySQL fetch is a translation of information received upon request to the database into a form convenient for processing.

mysql fetch array




On simple queries, the syntax of one sampling line is turned into an array; on stream queries, this is a tool for sequential processing of the information stream.

Syntax and Application Example

The input to the PHP MySQL fetch array receives the query result and the format of the desired result can be specified:

  • MYSQL_ASSOC;
  • MYSQL_NUM;
  • MYSQL_BOTH.

In the first case, an associative array will be formed, in the second case, an array with numerical indices, and in the latter case, an array with indices of both types will be available.

$aFetch = mysqli_fetch_array($cResult) $aFetch.

Author's example is not a picture




MySQL fetch array (1). fetch. (2) (3): $cFetch, $cFetch1, $cFetch2, $cFetch3.





Author's example is not a picture




, MYSQL_ASSOC, MYSQL_NUM MYSQL_BOTH , MYSQL_BOTH. .

MySQL fetch array

PHP. MySQL .

warning MySQL fetch array , $cResult , , . $cResult , . (2):

  • $cResult = mysqli_query($this->iConnectId, $cQuery);

$this->iConnectId - , .

MySQL fetch array - , - .

MySQL - . MySQL .





warning mysql fetch array




, , .

MySQL fetch , , , , :

  • ;
  • ;
  • ;
  • ;
  • .

, , , .

MySQL fetch - . . , .

php mysql fetch array




, , , .

, , , . : , . , .

It is even more convenient to add real-purpose objects over the object of access to the database. For example, a full-time description that has the following properties: a list, output of employee data, changing an employee’s card, etc. Data access tools are hidden in the bowels of methods of real objects, which simplifies the work of the developer and improves the quality of the result.




All Articles