Here is the content of my table:

How to count all names in different table cells to get a result like this?
- Bob-7
- Alex-3
- Ivan-5
- Nina-5
.........
With this code:
<?php
$q= mysqli_query($db, 'SELECT * FROM names');
while ($all = mysqli_fetch_array($q)) {
$k1= $all['Name1'];
$k2= $all['Name2'];
$k3= $all['Name3'];
$k4= $all['Name4'];
$k5= $all['Name5'];
$k6= $all['Name6'];
$arr[]= $k1;
$total_values = array_count_values($arr);
}
foreach ($total_values as $key => $value) {
echo $key .'-'. $value .'<br>';
}
My output result is:
- Bob-3
- Alex-1
- Ivan-1
- Nina-2
When I change my code to:
<?php
$q= mysqli_query($db, 'SELECT * FROM names');
while ($all = mysqli_fetch_array($q)) {
$k1= $all['Name1'];
$k2= $all['Name2'];
$k3= $all['Name3'];
$k4= $all['Name4'];
$k5= $all['Name5'];
$k6= $all['Name6'];
$arr=array($k1, $k2);
$total_values = array_count_values($arr);
foreach ($total_values as $key => $value) {
echo $key .'-'. $value .'<br>';
}
}
My output result is:
- Bob-1
- Alex-1
- Ivan-1
- Nina-1
- Nina-1
- Bob-1
- Bob-1
- Ivan-1
- Nina-1
- Nina-1
.......
What is wrong and what I have to do to add $k2, $k3....$k6 in the array $arr?