Verification: a143cc29221c9be0

Php array from query result

Php array from query result

Содержание

What is Mysql_fetch_array?

The function returns a row from a recordset as an associative array and a numeric array or both. The function gets a row from the mysql_query() function and it returns an array if it’s TRUE And when there is a failure or when there are no more rows then FLASE.

sql_mysql

Mysql doesn’t have a Fetch array function. mysql_fetch_array is a PHP function that will allow you to access data stored in the result returned from the TRUE mysql_query if u want to know what is returned when you used the mysql_query function to query a Mysql database. It is not something that you can directly manipulate.

Syntax

mysql_fetch_array(data,array_type)

Data required which specifies data pointer to use and the data pointer is the result from the mysql_query() function

Array Types

Possible values are:

  • *mysql_assoc this is for an associative array
  • *mysql_num this is for a numeric array
  • *mysql_both this is for default or both

Code

Output:

Array

{

[0] => Refsnes

[lastname] => Refsnes

[1] =>seesee

[FirstName] => seesee

}

A Row of Data

The mysql_fetch_array function takes a Mysql query resource as an argument

($result)and it will return the first row of data returned by the mysql_query.

mysql_fetch_array-table