I have posted a code I am working on and the result in array. please tell me how to choose only a part of the result from that array ? code
$sql = 'SELECT status, phone, COUNT(*) AS count FROM people WHERE phone=9876543210 GROUP BY phone, status';
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
print_r(array_count_values($row));
}
Result
Array ( [1] => 2 [9876543210] => 2 [14] => 2 ) Array ( [2] => 2 [9876543210] => 2 [10] => 2 ) Array ( [3] => 2 [9876543210] => 2 [5] => 2 ) Array ( [4] => 2 [9876543210] => 2 [1] => 2 )
How to choose and display only the number 14?
or only the number 5?
I want to ad the number 14 to a $value.
like echo $value; should result the number 14.
Update: I am not trying just to filter the results from the database, the usage is to count certain values.
I wan to display like "14 of your orders are approved, 5 of them cancelled, etc.."