I've got a PHP script where I am printing results from a .txt file, and I am wondering how I can sort the results on a field.
I've tried to figure it out looking at the sort functions, and I am just no sure how to put it together.
If you can post here, or email me, or go on YIM "live_gm_hockey" I appreciate it.
<?php
$fileArray = file($filename);
if ($fileArray === false) { // exactly false
echo "ERROR : unable to open '$filename'.<br />\n";
exit;
}
echo "<table>";
foreach(preg_grep("/$search/i", $fileArray) as $v){
$g = explode("|", $v);
echo "<tr>
<td>$g[0]</td>
<td nowrap align='center'>$g[1]</td>
<td nowrap align='center'>$g[2]</td>
<td nowrap align='center'>$g[3]</td>
<td nowrap align='center'>$g[4]</td>
<td nowrap align='center'>$g[5]</td>
<td nowrap align='center'>$g[6]</td>
<td nowrap align='center'>$g[7]</td>
<td nowrap align='center'>$g[8]</td>
<td nowrap align='center'>$g[9]</td>
<td nowrap align='center'>$g[10]</td>
<td nowrap>$g[11]</td>
<td nowrap align='center'>$g[12]</td>
<td nowrap align='center'>$g[13]</td>
<td nowrap align='center'>$g[14]</td>
<td nowrap align='center'>$g[15]</td>
<td>$g[16]</td>
</tr>";
}
echo "</table>";
?>