Hello
I want to learn how to make a script, that reads 2 tabels to find and print top 10 users
Table1:
postname - userid
Tabel2:
username - id
( userid = id )
the script needs to count and print top 10 users with most posts
#1 userA 1000 Posts
#2 userB 900 Posts
***
so far
$qry = "SELECT *, COUNT(userid) as `cnt` FROM table1, table2 WHERE userid = id GROUP BY userid ORDER BY cnt DESC LIMIT 0,10";";
$result = mysql_query($qry) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
echo $row["userid"];
echo $row["cnt"];
}
mysql_free_result($result);
this code don't print username only id, i want username
also how can i make it print into to columns "username" "#posts"
this code print like this
3333225614848152238156134101321073301129436232119
thank you