Ok, I’ve done a lot with CSV files, and whenever I have a problem, I come here. Well, here I am again. I’ve got a messageboard on a site, which is setup to grab the contents of a text file, and then put the contents onto the site. The file contains every post in the messageboard. When you add a post, it grabs the same file, and holds it’s data in the variable $oldposts. It then erases the contents of the file, and writes your post to it. it then adds in $oldposts, thus putting the file’s original contents back in. Thus, we have the old file, with the new post on top. So, through a slightly confusing method, I managed to get my messageboard’s posts automatically sorted newest to oldest.
Now comes the fun part. I’m looking to change this so that it writes it all into a csv file. It needs to grab the csv, move everything down 1 line, and add the new post into the blank line that it made at the top. Somewhat like so:
[quote]
post4date,post4data
post3date,post3data
post2date,post2data
post1date,post1data
and change it to
[quote]
post4date,post4data
post3date,post3data
post2date,post2data
post1date,post1data
Then add in post5date,post5data into the blank line at the top.
So normally my problem is that I messed up the code in some way. Now my problem is, that I have no clue where to start to make this work. So, does anyone have any suggestions/ideas/fully written and working solutions/etc… that they could give me? I’ll be fine getting something written for the page that views the messageboard posts, I just need help with the writing it all to csv part. Yes, this is something I’d normally take on easilly and then just come here for debugging help, but I’ve gotten a lot of php shooting through my head recently and i’m starting to get headaches. So yea, please and thanks to anyone and everyone!