Hi
I need to reverse the sort order of the chart in the link below.
The track names need to start with Daytona at the top and the matching results also reversed.
PHP code for the MySQL query is below the link.
Thanks
Don
http://www.theinsidegroove.com/nascar_races/nascar-driver-results-chart.php?raceYear=2004&raceDriver=Dale%20Earnhardt%20Jr.
$query = "select t1.race_number, t2.track_name from schedule as t1, track as t2 where year(t1.race_date)=".$yr." and t1.race_number<100 and t1.race_track=t2.track_id order by t1.race_number";
//build array of race/track names
$raceNames = array();
$awc->query($query);
while($row = $awc->nextRow())
{
$raceNames[$row->race_number]=$row->track_name;
}
$query = "select t1.finish, t1.race, t3.track_name from results as t1, schedule as t2, track as t3 where driver ='".$raceDriver."' and t1.yr=".$yr." and year(t2.race_date)=".$yr." and t1.race<100 and t1.race=t2.race_number and t2.race_track=t3.track_id order by race_date, race";
$awc->query($query);
$i=1;
while($row = $awc->nextRow())
{
// skip races that he didn't compete in
while($i < $row->race)
{
$chart['chart_data'][0][$i] = $raceNames[$i];
$chart['chart_data'][1][$i] = "";
$i++;
}
// drop thru and print actual results
$chart['chart_data'][0][$i] = $raceNames[$i];
$chart['chart_data'][1][$i] = $row->finish;
$i++;
}
reset($raceNames);
DrawChart($chart);