
Description
Use get_row to retrieve a single row from database. If there is more than one row returned by query still this function returns only one row which will be either first row or any row specified through $row_offset variable. This function can return row as an object, an associative array, or as a numerically indexed array.
get_row returns NULL, if no result is found.
Format
1 |
<?php get_var($query, $output_type, $row_offset); ?> |
Parameters
$query (required)
(string) The query you wish to run. Setting this parameter to NULL will return row data from cached result of last executed query.
$output_type (optional)
(pre-defined) One of the three pre defined constants. Defaults to ‘OBJECT’
- OBJECT – result will be output as an object.
- ARRAY_A – result will be output as an associative array.
- ARRAY_N – result will be output as a numerically indexed array.
$row_offset (optional)
(integer) The desired row ( first row is 0). Defaults to 0.
Usage
1 |
<?php get_row(" SELECT * FROM users WHERE user_id = 5 "); ?> |
Returns
get_row returns row data returned in format as set through $output_type variable.
If no result is found this function returns NULL.
Pingback: Maria Smith()