Jump to content

Question RE explode()


MrXander

Recommended Posts

Hi there,

 

Wondering if someone can point out where I'm being thick...

 

Basically, I am making a news script using flatfile. Below is how the script stores the news post (this isn't the problem, keep reading)

$theNews = "";
$theNews .= 'Welcome,General,Test';
$theNews .= 'Test,General,Hmm?';

 

Then, I am trying to make a list of all news posts so that users can edit a single post if they wish. I want to seperate the news posts, so I thought of using the following code:

 

$string = "'";
$theNewsPosts = explode($string, $theNews);
$count = count($theNewsPosts);
echo $count;

But it only picks up the first line, so can anyone help?

 

Thanks.

Link to comment
Share on other sites

I second the database comment.

 

What is the format of the data exactly? Are there titles to the posts, or just posts? Are single posts always in single quotes?

I agree with the database comment, but I know a lot of people who don't have a clue about databases, so I thought I'd make something to help.

Anyway, the format?

 

ex: $theNews .= 'Welcome,General,Test';

"Welcome" = The title

"General" = The category it's posted in

"Test" = The body of the post

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.