/    Sign up×
Community /Pin to ProfileBookmark

Messageboard posts into a csv

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

[/quote]

and change it to

[quote]

post4date,post4data
post3date,post3data
post2date,post2data
post1date,post1data

[/quote]

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!

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@bokehJul 11.2006 — Ant, why are you so stubborn. Every question you ask is down to not using a database. You are running the site on your own server so there is no reason not to be running the correct software.
Copy linkTweet thisAlerts:
@AmazingAntauthorJul 11.2006 — Let's put it this way, In order to work with a MySQL or another database type thing, I'd have to learn [i]how[/i] to work with it. With all the freetime I have, it should be no problem to download, install, and learn how to use database stuff, right? Right. I've already download MySQL, Installed it, and tryed to learn it. The problem is, that for one reason or another, I just can't get the hang of it. Yet, I go ahead and do a little extra so as to use csv files, and within an hour, I have it working just fine. So, I am running the correct software, and I am [i]using[/i] the correct methods. I'm running your fancy-pancy database junk that I can't work with, and i'm using what works for me. That's why I'm so stubborn about this. Unless you're gonna learn me how to make the database stuff work, I can't learn how to use it any faster. And until I learn how to use it, I'm gonna continue to use what is right for [i]me[/i], not you.
Copy linkTweet thisAlerts:
@bokehJul 11.2006 — I'd be happy to attempt to answer your questions on DB stuff.
Copy linkTweet thisAlerts:
@AmazingAntauthorJul 11.2006 — That's nice, but by "Unless you're gonna learn me how to make the database stuff work," I didn't mean answer questions. I meant teach me the basics and [i]then[/i] answer questions. And plus, I didn't start this thread to argue about how and why I should be using a DB, so can anyone help with my original request for help, or should i just ignore this thread now?
Copy linkTweet thisAlerts:
@bokehJul 11.2006 — Well no one taught me. There is so much reading material that learning the basics is childs play. There are only four types of queries and thats it; whereas with all this text formatting there are so many functions you need to learn.
Copy linkTweet thisAlerts:
@AmazingAntauthorJul 11.2006 — that's very nice. the problem isn't finding information, the problem is that i don't understand th DB stuff. I do however understand all the many different functions that I need to work with the csv files. So i'm gonna go ahead and unsubscribe from this, because I really don't need to listen to this anymore.
×

Success!

Help @AmazingAnt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...