i'm trying to add a line to a data file and then sort the file. being a beginner, i have written the following code, which i know is far too long and over-complicated. trouble is, it makes internet explorer hang and time out. what am i doing wrong? (it all works ok until i try to write the file. commenting out the last section stops the hangs.)
$filehandle = fopen("data_movie", "a");
fputs($filehandle, "$title$media$notes\n");
fclose($filehandle);
$filetosort = file("data_movie");
$sizeof = count($filetosort);
sort($filetosort);
$filehandle = fopen("data_movie", "w");
for($i = 0; i < $sizeof; $i++)
{
fputs($filehandle, $filetosort[$i]);
}
fclose($filehandle);