I am having problem with it. I have one echo for my news row that lists the news. I want to end the lines after dots and question marks (both) and i couldn't find a way.. Using substr instead is not a good idea. *is puzzled*
I use $i= explode(".", $row['news']); Code (markup): then echo $i[0]; Code (markup): when i use two explode commands i get two echos.
It gets the news from db and prints it there. I am trying to make kinda read more... thing. So i want to end the lines from dots or question marks.
Haven't tested this code but here's my suggestion. $news = str_replace ( ".", ".<br><br>", $news ); $news = str_replace ( "?", "?<br><br>", $news ); echo $news; PHP:
It echoes nothing now rvarcher @piniyini what matters the news content? say first news is like blah blah, blah blah? blah blah. and second is like blah blah blah blah. blah blah blah. $news = str_replace ( ".", ".<br>", $news ); $news = str_replace ( "?", "?<br>", $news ); echo $news; Code (markup): All my news start with code <p> may be that?
@rvarcher i got the problem that was becase i didn't call it from db. But what i want to do is get just some part of the news. Then when it is clicked it goes to the full news. The way you write prints all the news under them
I'm not sure what you're trying to do. Are you taking a set of news stories and outputting the first sentence of each story to create something like an index list? (Like something I would see on http://news.yahoo.com)