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
Post a Comment