If you want to do it on a # of char's (the easiest), check out substr() in the manual.
Otherwise, to break on a full word, this will do the job: Do your query as per usual, the below assumes your text thing is $fulltext. <? $fulltext = "one two three four five six seven eight nine"; // config $word_count = 5; // number of words desired minus 1 $append = "... subscribe or log-in to read this fully."; // create teaser text $teaser = strip_tags($fulltext); $teaser = explode(" ", $teaser, $word_count); array_pop($teaser); $teaser = implode(" ", $teaser); $teaser .= $append; echo $teaser; // this will print: // "one two three four five six... subscribe or log-in to read this fully." ?> I put strip_tags() in there, because if you have a tag it will: a) screw up the word count (<A HREF="foo" TARGET="foo"> contains 3 spaces) b) screw up the page if <B>foo bah</B> gets trimmed to <B>foo... the rest of the page will be bold Like I said, substr() is a helluva lot easier, but could break mid-word. Justin French -------------------- Creative Director http://Indent.com.au -------------------- on 29/04/02 7:44 PM, r ([EMAIL PROTECTED]) wrote: > Greetings all, > Special greetings to all my new PHP list pals, you know who you are. > > Sorry to be so mysterious in the subject line but i dont know how to explain > this in one line. > > ever visit a site and you get this text (Or something like this...heheh) > > "This morning shockingly Bill Gates claims he is broke! > The kooky billionaire is.......(link)subscribe / login to read this fully." > > "This morning shockingly Bill Gates claims he is GAY! > The kooky billionaire is.......(link)subscribe / login to read this fully." > > "This morning shockingly Bill Gates claims he is impotent! > The kooky billionaire is.......(link)subscribe / login to read this fully." > > etc etc > > > Basically, its querying the database and instead of displaying the whole > results it just taking the first 2 lines or X number of characters and then > adding the link stuff.....any idea how to do this? > > NOTE:Before i get you microsoft lovers coming after my throat.......I HAVE > NOTHING AGAIN BILL GATES/MICROSOFT. > I actually use a lot of his companys software...am running win2k myself. > Get off my back. > > And for the rest of you who think that i am suffering from insanity....you > are wrong...I am enjoying every minute of it! > heheheh ahhahahah ahahhah GAGAGAGAG HAHAHA HEHEH > > ANY help appreciated. > Cheers, > -Ryan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php