MySQL and PHP arrays handling
-
Hi. I have this php code :
$results = $wpdb->get_results(“SELECT country, COUNT(*) FROM $wpdb_table)
$results is a associative bi-demensional array, 1rt coloumn named country, the 2nd COUNT(*)
then I would like to retrieve data from each row but if I am able to read 1rst coloumn values, I cannot with second one :
if (count($results) > 0) {
for($x = 0; $x < $arrlength; $x++) {
echo “country: ” . $results[$x]->country;
echo “reads: ” . $results[$x]->COUNT(*). “
“;
}
} else {
echo “0 results”;
}
$results[$x]->COUNT(*) does not access any field !!!!
Might anyone tell me why ? Is * a special character ? how do I have to handle it ? Any other php functions I might use ?
Thanks a lot to anyone
- The topic ‘MySQL and PHP arrays handling’ is closed to new replies.