I have the output of the code below in a count command and need to get the answer into a single variable... like $dog = 88; but so far unsuccessful.. is there a simple way to do it.. I have tried $result[0] and $result[total] when I temp changed the query to as total but nothing seems to work... ( [0] => stdClass Object ( [COUNT(*)] => 88 ) $results = $wpdb->get_results('SELECT COUNT(*) FROM wp_realty_listingsdb WHERE DOM = 0'); print "<pre>"; print "Total DOM 0 = "; print_r($results); print "</pre>"; Code (markup):
Then you should post the solution here, so that others can find it if they're looking for a solution to that problem.
Well if anyone is curios since he's using wpdb it has some parameters you can pass to it One of three pre-defined constants. Defaults to OBJECT. OBJECT - result will be output as an object. ARRAY_A - result will be output as an associative array. ARRAY_N - result will be output as a numerically indexed array. $results = $wpdb->get_results('SELECT COUNT(*) FROM wp_realty_listingsdb WHERE DOM = 0',ARRAY_N); Code (php): Then just $result[0][0] . Hope that helps anyone else with that issue.