Question

query is: SELECT status, COUNT(*) totalCount FROM clients GROUP BY status

which, after a

while ($row = mysqli_fetch_assoc($total) ) {

echo "<pre>";
var_dump($row);
echo "</pre>";}

outputs the occurrences of the distinct values in status column:

array(2) {
["status"]=>
string(6) "start"
["totalCount"]=>
string(1) "1"
}

array(2) {
["status"]=>
string(4) "middle"
["totalCount"]=>
string(3) "151"
}

array(2) {
["status"]=>
string(7) "end"
["totalCount"]=>
string(2) "17"
}

question is how do I access say, just the ["status"]=>"middle" key and value of the array with an echo?

Many Thanks

Was it helpful?

Solution

worked after some reading and then some more reading that you cant...but what you can do is throw the loop into an array which will create an multidimensional array via which you can access the values directly and individually :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top