Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Database API > QueryResult object

QueryResult object: fetchAssoc()

Scroll Prev Next More

 

The fetchAssoc() function returns the record as an associative array: "field" => value.

Syntax

fetchAssoc()

Arguments

No arguments.

Return value

Returns the record as an associative array: "field" => value.

 
Null, if there are no matching records.

Example

$rs = DB::Query("select * from carsmake");
while( $data = $rs->fetchAssoc() )
{
echo $data["id"];
echo $data["make"];
}

See also:

Database API: Query()

QueryResult object: fetchAssoc()

QueryResult object: fetchNumeric()

QueryResult object: value()

Database API: Exec()

Database API: Select()

Database API: PrepareSQL()

Using SQL variables

About Database API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software