simple PHP help **newbie**
Posted: Sun Apr 02, 2006 9:02 am
Hi,
Ive writen a short php...
This then outputs (below) to show the vars "newsText=" and some text from mySQL.
Thats all great BUT....
I need another php script to shorten it down so that it only retrieves about 6 words then adds "....." after it. for a snippet of news that is displayed in another area.
So basically i need to end up with...
Any help is much appreciated!
Ad,
Ive writen a short php...
Code: Select all
newsText=
<?php
$db = mysql_connect("localhost", "***********", "******") or die(mysql_error());
mysql_select_db("adamck_*******") or die(mysql_error());
$que = "SELECT * FROM phpbb_notes";
$res = mysql_query($que);
if (!$res)
die(mysql_query());
while ($row = mysql_fetch_assoc($res)) {
echo stripslashes($row["text"]);
}
?>Code: Select all
newsText= Latest news Apr 06 Latest new will be in this section of the website and will be displayed dynamically! loads of text here loads of text here loads of text here loads of text here loads of text here loads of text here loads of text here loads of text here loads of text here loads of text here loads of text hereI need another php script to shorten it down so that it only retrieves about 6 words then adds "....." after it. for a snippet of news that is displayed in another area.
So basically i need to end up with...
Code: Select all
newsText=Latest news Apr 06 Latest new....Ad,