Function Reference / get_results – ezSQL

get_results is a method of ezSql Class and it can be used to retrieve multiple rows from database. This function returns result in one of three formats which can be Object, Associative or Numerically indexed array.

ezSql - get_results


get_results is a method of ezSql Class and it is used to retrieve multiple row results. This function returns the entire query result as an array. Each element of this array corresponds to one row of the query result and like get_row (ezSql), can be an object, an associative array, or a numbered array.

If no matching rows are found, or if there is a database error, the return value will be an empty array. If your $query string is empty, cached result from last query are returned and if you pass an invalid $output_type,nothing will be returned.



$query (optional)

(string) The query you wish to run. Setting this parameter to NULL will return row data from cached result of last executed query. Default is NULL.

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




Object/Array depending on output format  on success,

if no result than NULL on OBJECT , empty array on ARRAY_A, ARRAY_N