Thank you for all suggestions, and yes I have read them, but
i did not understand exactly.
Iv updated the script. The problem now is that only the
Food row is sorted. When I click on any of the other rows
nothing happens. Any new suggestions is greatly apreciated ?
Sorry for asking again, but being a programming illiterate,
i need everything in with a spoon๐
<?
$d = array(
'Food',
'Eatable(%)',
'Water(g)',
'Energy(kj)',
'Protein(g)',
'Fat(g)',
'Carbohydrates(g)',
'Fibre(g)',
'Sugar(g)',
'Iron(g)',
'Vitamine C(mg)'
);
echo "<table border=1>";
echo "<tr>";
foreach ($d as $desc) {
echo "<td class=o><a class=cd href=$_SERVER[PHP_SELF]?sorting=$desc>$desc</a></td>";
}
echo "</tr>";
function sorting($d, $b) {
if ($d == $b) { return 0; }
else { return ($d > $b); }
}
$file = file("food_nutrient_content_table.txt");
usort($file, 'sorting');
foreach ($file as $value) {
$del=split(";",$value);
echo "<tr>";
for ($i=0; $i<=10; $i++) {
echo "<td class=p>$del[$i]</td>";
}
echo "</tr>";
}
echo "</table>";
?>