Let’s get to the main jokes of the class. With the getVar
method, we get the only value returned by your query. For example, I want to take only one member’s name, or the total number of members.
<?php
//A user's name
$name = DB::getVar('SELECT name FROM users WHERE id = 1 LIMIT 1');
echo 'Hello ' . $name;
//Or the total number of users
$count = DB::getVar('SELECT COUNT(id) FROM users');
echo 'Total number of members ' . $count;
?>