Please enable JavaScript to view this site.

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

QueryResult object: value( fieldname or index )

Scroll Prev Next More

 

This is an alternative way of working with the query. Convenient to use when the query returns a single record.

 

This function should not be used together with fetchAssoc or fetchNumeric.

Syntax

value( fieldname or index )

Arguments

A fieldname or index.

Return value

Value.

Example1

$rs = DB::Query("select * from Cars where id=20");
echo $rs->value("Make");

Example2

$rs = DB::Query("select count(*) from Cars");
echo $rs->value(0);

See also:

Database API: Query()

QueryResult object: fetchNumeric()

QueryResult object: fetchAssoc()

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