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
https://forums.phpfreaks.com/topic/71433-question-re-explode/
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
https://forums.phpfreaks.com/topic/71433-question-re-explode/#findComment-359559
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.