Database query works fine outside WordPress

After struggling with different functions , I figure out $wpdb->get_row() and $wpdb->get_var()
The first one returns rows into an associative array or numerical array , depends on the second argument in $wpdb->get_row('query',ARRAY_A or ARRAY_N or OBJEECT) and the second one that I used to solve my problem return only one variable from particular table.
e.g,

<?php
$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
echo "<p>User count is {$user_count}</p>";
?>

Reference link