Finding and printing most common value within MySql database using PHP -


i have code retrieve values, don't know how return modal value in array.

$stuff = "select count (subjectno) subjectallocation"; $direct = mysqli_query($link, $stuff);  while($row = mysqli_fetch_array($direct)){     echo $row['count (subjectno)'];     echo "<br />"; } 

i understand performing count, want define base start from.

here 1 method getting "mode" -- statistical term common value:

select subjectno subjectallocation group subjectno order count(*) desc limit 1; 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

sql - MySQL not catching error -