hi im trying to sort my table by descending percents...the following code below creates the table with all the states and its associated percentage of accounts...but this table is sorted based on teh state...is there anyway i can sort the table based on the percents..after they are calcuated...sorry if this may sound a little confusing...any help would be aprreciated..thanks 🙂
$result0 = mysql_query("SELECT ahaddrstate AS state FROM account where active = 'y' and open = '1' GROUP BY state");
$rows0 = mysql_num_rows($result0);
while($myrow0 = mysql_fetch_row($result0)){
$state = $myrow0[0];
$query2 = mysql_query("SELECT account_id FROM account WHERE ahaddrstate = '$state'");
$rows2 = mysql_num_rows($query2);
$statePercent = (($rows2 / $rows1) * 100);
$statePercent = number_format($statePercent,2);
print "
<TR>
<TD>
<FONT size=3 face=\"arial\">
$state
</FONT>
</TD>
<TD ALIGN=RIGHT>
<FONT size=3 face=\"arial\">
$statePercent%
</FONT>
</TD>
</TR>
";