aql::value()
From SkyPHP
aql | aql value |
Retrieve one specific value from the database.
Contents |
Description
string value ( string $field_name, int $id )
string value ( string $field_name, string $ide )
string value ( string $field_name, string $slug )
array value ( string $field_name, array $id_array )
array value ( string $aql, int $id )
array value ( string $aql, string $ide )
array value ( string $aql, string $slug )
array value ( string $aql, array $id_array )
Parameters
field_name - field name to retrieve in "table.field" format
aql - aql statement to retrieve
id - id of the record
ide - encrypted id of the record (see encrypt)
id_array - array of integer id values or encrypted ide values
Return Values
returns a string value from the database OR an array of values
Examples
Display the first name of the person who is logged in
echo aql::value( 'person.fname', PERSON_ID );
Display the first & last name of the person who is logged in
echo aql::value( 'person { fname, lname }', PERSON_ID );
Display the first name of 5 people in the database
$person_id_array = array(1,2,3,4,5);
$rs = aql::value( 'person.fname', $person_id_array );
foreach ( $rs as $person ) {
echo $person['fname'] . '<br />';
}
See Also
Known Bugs & Issues
n/a
