
Description
get_var is used to retrieve a single variable from database. Though it returns only single variable but whole query is saved in cache and can be accessed through “last_result” function.
This function returns ‘NULL’ if no result is found.
Format
1 |
<?php get_var($query, $col_offset, $row_offset); ?> |
Parameters
$query (required)
(string) The query you wish to run. Setting this parameter to NULL will return cached variable from last query.
$col_offset (optional)
(integer) The desired columns. First is 0, defaults to 0
$row_offset (optional)
(integer) The desired row. First row is 0, defaults to 0.
Usage
1 |
<?php get_var("SELECT count(*) FROM users"); ?> |
Returns
Single value on success, NULL if no result is found.