steelerboi Posted March 31, 2010 Report Share Posted March 31, 2010 Hi Nabeel, Just thought you might like to know that the TopRoutes function in StatsData.class.php needs a slight change to the SQL query to make it work. The query as it currently stands is $sql = 'SELECT * FROM `'.TABLE_PREFIX.'schedules`'; if($airline_code != '') { $sql .= " AND `code`='{$airline_code}' GROUP BY `code`"; } $sql =' ORDER BY `timesflown` DESC LIMIT 10'; However, this doesn't work as the 'AND' needs to be a 'WHERE'. Also, there's a period missing before the = in the 2nd sql join. The other thing which I had to change in order to get it working on my site, was to remove the GROUP BY `code` since no results were returned if this was left in. I only have the one code anyhow, so it's no biggie for me Anyway, here's the query which I now use: $sql = 'SELECT * FROM `'.TABLE_PREFIX.'schedules`'; if($airline_code != '') { $sql .= " WHERE `code`='{$airline_code}'"; } $sql .= ' ORDER BY `timesflown` DESC LIMIT 10'; Kind regards, Nige. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 31, 2010 Administrators Report Share Posted March 31, 2010 Woops, fixed! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.