I am attempting to use a database to rank a set of Teams for my site.
I have ten teams and need to Display them in order in a table.
I know how to structure my query to get the information that I want but I need to know how to use the information.
code:
$query = "SELECT T_Name,T_Score,T_Rank
FROM {$config['tbprefix']}teams
ORDER BY T_Rank ASC
";
$sth = $dbh -> do_query($query);
$total = $dbh -> total_rows($sth);
for($i=0;$i<=10;$i++){
list ($name,$score) = $dbh -> fetch_array($sth);
$userrow[$i]['teamname'] = $name;
$userrow[$i]['teamscore'] = $score;
}
$dbh -> finish_sth($sth);
echo "{$userrow[$i]['teamname']}";
Above is what I have so far but it does not seem to be doing the desired effect.
I would like:
Ranked #1 :TeamA Score
Ranked #2 :TeamD Score
Ranked #3 :TeamB Score
Ranked #4 :TeamC Score
To get the above information I would like to use the Rank # in my HTML.
i.e.
code:
Rank #1 :$rank1[teamname] $rank1[score]
Rank #2 :$rank2[teamname] $rank2[score]
Any assistance appreciated.....