Monday, 26 August 2013

Need help removing duplicate columns in a mysql result

Need help removing duplicate columns in a mysql result

Ok, basically said, I have a website that returns results by country.
There is a query that returns this, then I use a loop to output the data.
The only problem is that for one of these, there is a sub-50 column and
the results are the same all the way to the sub-36 column. I need help
removing the duplicate columns.
// By country
// sort countries by most subXs in descending order
arsort($country_sub{$dsub});
// print results
echo "<b><span style='font-size:20px;'>By Country</span></b>";
echo "<table><tr style='font-weight:bold;'><td
style='width:100px;'>Country</td><td>sub".$dsub."</td>";
for($i=$dsub-1; $i>=$x; $i--){ echo "<td>sub".$i."</td>"; }
echo "</tr>";
foreach($country_sub{$dsub} as $country => $value){
echo "<tr><td>".$country."</td><td>".$value."</td>";
for($i=$dsub-1; $i>=$x; $i--){
if (isset($country_sub{$i}[$country])) {
echo "<td>".$country_sub{$i}[$country]."</td>";
} else{
echo "<td></td>";
}
echo "</tr>";
}
echo "</table><br/>";
The array $country_sub{$dsub} contains the number of people with that
result or less. The foreach loop is what outputs the top numbers, and the
for loop is what outputs the results itself.
You can see where this code is used at this link:
http://cubingstats.netau.net/3bld/index.php. It's used in the "By Country"
section. All I want is in that table, to show sub 36 and sub 27 (the ones
listed above). I need to launch this by tomorrow, so any help is extremely
useful!
Thanks in advance

No comments:

Post a Comment