php - How do I know the number of times a value occur in a mysqli selection -


please how know number of times david has vote of 2

name  | vote ------------- |gabri| 2 |david| 2 |janny| 3 |david| 1 |david| 2 |fally| 3 

$sql = "select count(*) table_name name= 'david' , vote=2"; $result = mysqli_query($con, $sql); $fetch = mysqli_fetch_assoc($result); echo "<pre>"; print_r($fetch); echo "<pre>"; 

outputs

array (     [count(*)] => 4 ) 

to value need echo $fetch['count(*)']; //outputs 4


Comments