I only started php yesterday but have programming experience but sorry if this is a very elementary thing!
I have a form which is filled out to update news.. i add the information to a file& it then puts this on a page but the problem is the oldest news is displayed first...
I use two files, one for old news & one for new news.
What i'm trying to do is:
first add the new news to the file,
then create an array with the old news information,
then add the old array to end of new file,
then copy new file to old file so it will all be old news next time.
$newfile = "comments.txt";
$oldfile = "oldcomments.txt";
$f_write = fopen($newfile, "a");
/adding the line into the file
//create array with c ontent of old file
$array2 = file($oldfile);
//add array to new file
for( $i=0; $i < count($array2); $i++ )
//delete old file before copy new one to it
//copy new file to old file
//closing the file comments.txt