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.
<?php get_var($query, $col_offset, $row_offset); ?>
(string) The query you wish to run. Setting this parameter to NULL will return cached variable from last query.
(integer) The desired columns. First is 0, defaults to 0
(integer) The desired row. First row is 0, defaults to 0.
<?php get_var("SELECT count(*) FROM users"); ?>
Single value on success, NULL if no result is found.