MySQL Forums
Forum List  »  PHP

How to put the array into a single variable.
Posted by: Tom Chambers
Date: September 11, 2016 04:13AM

Mysql looks like the below.. how can I capture the single result into a single variable..
I tried $results[total] and $results[0] but neither worked for me..
I want it to look like $mycount = 88 or something similar.

$results = $wpdb->get_results('SELECT COUNT(*) FROM wp_realty_listingsdb WHERE DOM = 0');
print "<pre>";
print "Total DOM 0 = ";
print_r($results);
print "</pre>";

(
[0] => stdClass Object
(
[COUNT(*)] => 88
)
)

Options: ReplyQuote


Subject
Written By
Posted
How to put the array into a single variable.
September 11, 2016 04:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.