Possible Duplicate:
sorting php data var problem
This should be pretty easy to follow looking at my code, but my code still isn't working. Could someone please just tweak this until it works? I'm at my breaking point and feel a full blown code-induced breakdown coming on!
I want to sort the data by player number, and then the person with the highest point should have their whole row colored red:
file1.php
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Fantasy Football</title>
</head>
<body>
<form action="roster.php" method="POST">
<table border="1">
<tr><td>Player Name</td><td><input type="text" name="name"</td></tr>
<tr><td>Position</td><td><input type="text" name="position"</td></tr>
<tr><td>Number</td><td><input type="text" name="number"</td></tr>
<tr><td>Team</td><td><input type="text" name="team"</td></tr>
<tr><td>Points per game</td><td><input type="text" name="points"</td></tr>
<tr><td colspan="2" align="center"><input type="submit"></td></tr>
</table>
</form>
</body>
</html>
roster.php
<?php
for($i = 0; $i < sizeof($players); $i++) {
list($name[],$team[],$number[],$position[],$points[]) = explode('|', $players[$i]);
}
array_multisort($number, $position, $name, $team, $points, SORT_DESC);
$mostPoints = max($points);
for($i = 0; $i < sizeof($players); $i++) {
if($points[$i]==mostPoints){
echo '<tr style="background:#F44">';
}else{
echo '<tr>';
}
echo '<td>'.$name[$i].'</td><td>'.$team[$i].'</td><td>'.$number[$i].'</td>
<td>'.$position [$i].'</td><td>'.$points[$i].'</td></tr>';
}
?>
When I run this, it like it can't access the data in the txt file. WHAT AM I MISSING?
varthat I mentioned in your previous exact question.