i have created an student enrolment form which then grabs the students selections and writes it to a flat file..ie
<?
$out=$fname."\t".$lname."\t".$address."\t".$suburb."\t".$country."\t".$status[0]."\t".$status[1]."\t"
.$compulsory."\t".$elective[0]."\t".$elective[1]."\t".elective[2]."\t".$elective[3]."\t";
$fp=fopen("data.txt","a");
fwrite($fp,$out);
fclose($fp);
?>
now i want to covert that flat file into a multi-dimensional array for sorting and displaying. Could anyone advise me
why this following code won't do this? It prints out Array[0]Array[1]Array[2]...etc
in the browser and not my students data.
<?
$enrolls = file("data.txt");
$number_of_enrolls = count($enrolls);
if ($number_of_enrolls == 0)
{
echo "No enrollments received. Try again later";
}
for ( $i=0; $i<$number_of_enrolls; $i++ )
{
$line = explode ("\t", $enrolls[$i] );
$students[$i] = $line;
}
for ($row=0; $row<$number_of_enrolls; $row++ )
{
for ($column=0; $column<$number_of_enrolls; $column++ )
{
echo "$students[$row][$column]";
}
echo "<br>";
}
?>