There is a database with a user table, in which the rsite column displays information from which site the users came from. trying to conclude the number of sites from which the user came, it turned out:
$dbh = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL."); mysql_select_db($database) or die("Не подключаюсь."); $query = mysql_query("SELECT rsite, COUNT(rsite) AS cnt FROM user GROUP BY rsite asc"); echo "<caption>Количество регистраций с сайтов:</caption>"; while ($row = mysql_fetch_array($query)){ echo "<table><tr><td>".$row['rsite']." - ".$row['cnt']."</td></tr></table>"; } here the name of the site is displayed and through the dash the number in the table with the ordering alphabetically "rsite asc", i.e.
- asite - 3
- bsite - 1
- csite - 10
and how to make ordering by quantity, i.e.
- bsite - 1
- asite - 3
- csite - 10
thanks for the answer
order by COUNT(rsite)- Mikeorder byis written at the end of the request - Mike