Method Reference / get_row – ezSQL

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

<?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’

$row_offset (optional)

(integer) The desired row ( first row is 0). Defaults to 0.

Usage

<?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.