Trying to echo the array value from my mysql query (inside Wordpress snippet)
function get_customer_gain() {
global $wpdb;
$users = $wpdb->get_results( "SELECT SUM(wp_wpdatatable_1.payback) FROM wp_wpdatatable_1");
foreach( $users as $user ) {
echo $user;
}
}
add_shortcode('customer_gain', 'get_customer_gain');
my var_dump is: array(1) { [0]=> object(stdClass)#3098 (1) { ["SUM(wp_wpdatatable_1.payback)"]=> string(6) "183320" } }
So basically im trying to echo that 183320 number
Any guidance would be appreciated.
Thanks
$number = $wpdb->get_var(SELECT SUM(..."
; – Finding