Overview of retrieving data in result sets
The SELECT statement
of the SQL language returns a result set. A result set consists of
rows and columns. The data is retrieved row-by-row and the columns of
each row are stored in an array.
Syntax
<result_set_function>
::= <fetch_assoc> |
<fetch_object> | <fetch_row> |
<num_columns> | <column_info> |
<free_result>
Description
The functions to work
with result sets are:
fetch_assoc This
function retrieves the data row into an associative array, using the
column names as index
fetch_object This
function retrieves the data row into an PHP5 object, using the
column names as property identifiers
fetch_row This
function retrieves the data row into a regular array, indexed from
zero to the number columns minus 1
num_columns This
function returns the number of columns in a result set
column_info This
function returns information about a cooumn in the result set, such
as its name, type and size.
free_result This
function closes the result set and frees the resources associated
with the it
Data is converted from SQL types to PHP types as
described in the next section.
|