Re: REGEX? SQL? Getting only so much from a long field
| From: | Pablo Vera | Date: | Mon, 16 Oct 2000 21:53:43 +0000 |
| Subject: | Re: REGEX? SQL? Getting only so much from a long field | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3278@lists.php.net to get a copy of this message | ||
John:
You can try the following (I have never used them, but...):
1. Get the position of the first <BR> using strpos():
$pos = strpos($longstory,"<BR>");
2. Extract the first part using substr():
$preview = substr($longstory,1,$pos-1);
3. Show the preview:
echo $preview;
You can check these functions in the PHP manual under String Functions.
I hope this helps.
Saludos,
Pablo Vera
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Monday, October 16, 2000, 2:38:21 PM, John wrote:
AJ> Hello all,
AJ> I've got some long stories in a news database. I want to make a little
AJ> "preview" type function that only spits out the first paragraph and then
AJ> says "read the rest"... what I can't figure out is how to have it just
AJ> read the field up to the first <br> tag. (all of the stories have these
AJ> added when the story is put into the database. Any suggestions?
AJ> John
AJ> ---------------------
AJ> John Asendorf - jasendorf@lcounty.com
AJ> Web Applications Developer
AJ> http://www.lcounty.com - NEW FEATURES ADDED DAILY!
AJ> Licking County, Ohio, USA
AJ> 740-349-3631