php - MYSQLi Count and Group by -


i have table (sample)

|---id---|---place---|---admin---| |    1   |    q      |    aj     | |    2   |    p      |    pm     | |    3   |    w      |    aj     | |    4   |    t      |    ty     | |    5   |    u      |    aj     | 

i want count how many places each admin control using mysqli not mysql. have searched , found mysql , using count(*) , when trying use it, not work.

thanks in advance.

$result = mysqli_query("select admin, count(admin) 'amount' tablename group admin"); while($row = mysqli_fetch_assoc($result))     echo "name: " .  $row['admin'] . " - ". $row['amount'] . "<br />"; 

using count + group by can amount of times each admin appears in table.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -