My mind is in a freeze, and I can't figure it out!

Here's what I have:

Tables:

users- Table with username/passwords, etc;
Data1- Table with user Posts
Data2- Table with user Posts

I want to have a contest of who posts the most in the two tables from Date1 - Date2. I can't seem to figure the logistics of this. Her'es what I have in a nut shell:

$t = "";
$sql = "SELECT * FROM users";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
$username = $row['username'];
$sql1= "SELECT FROM Data1, Data2 WHERE Date > 2001-05-01 AND username='$username'"
$result1 = mysql_query($sql1);
$posts = mysql_num_rows($result);
$t[$username] = "$posts";
}
// somehow sort out $t

$i = "0";
foreach($t as $username=>$posts){
if($i < 11){
echo("<b>$username</b> Has <b>$posts<b> Posts!");
}
$i++;
}


My major lack is how to sort these? And will this idea work?

Thank you for all of your help!

Alex Stanton