\n"; echo "\n"; echo "\n"; for ($i=0;$i \n"; } else { if (abs($sortby)!=$sortby) { echo " \n"; } else { echo " \n"; } } } echo "\n"; reset($data); $eo=0; while (list ($row,$rowdata)= each($data)) { $eo++; if ($eo%2) { $evenoddrow="evenrow"; } else { $evenoddrow="oddrow"; } echo " \n"; echo " $eo\n"; while (list ($col,$coldata)= each($rowdata)) { if ($coldata) { echo " $coldata\n"; } else { echo "  \n"; } } echo " \n"; } echo ""; } function compare($a, $b) { global $sortby; $sb=floor(abs($sortby)); ############################# # See if a & b are numeric # ############################# if (is_numeric($a[$sb])&&is_numeric($b[$sb])) { if ($a[$sb]==$b[$sb]) { return(0); } else { if ($sortby>=0) { return ($a[$sb] < $b[$sb]) ? -1:1; } else { return ($a[$sb] > $b[$sb]) ? -1:1; } } } ########################## # a & b are not numeric # ########################## if ($sortby>=0) { return strcmp(trim($a[$sb]), trim($b[$sb])); } else { $sb=abs($sortby); return strcmp(trim($b[$sb]), trim($a[$sb])); } } function multi_sort($array) { usort($array, "compare"); return $array; } ############################ # Begin Page Generation ############################ $data=readCSVfile($filename); echo "\n\n"; echo "\n"; echo "\n"; echo "\n\n"; $data2=multi_sort($data); writetable($data2); echo "\n\n\n"; ?>