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

    Thanks. Although I wasnt able to get much help from that, it did lead to further reading elsewhere which led to

    while ($row = mysqli_fetch_assoc($total) ) {
    £array[] = $row;

    }

    which creates a multidimensional array where I can access the individual Key & Values 🙂)

      Write a Reply...