Pam
Hi, that didn't work 1st time although it certainly got me moving in the right direction.....it repeated each word (1 to 10) with the hypertext link "read more>>>" attached to each word which was very messy indeed.
I did a bit of juggling around and managed to get it perfect.

Many thanks for your help, greatly appreciated.

Regards
Jeremy

FYI:




<?php

function cut_string($string,$wordnum)
   {
       $string_arr=explode(" ",$string);
       for($i=0;$i<$wordnum;$i++)

       {
           $re_string=" ".$string_arr[$i];
$str=$re_string; print $str;
       }
   }

//connect, select db, create query, run query, close connection
$conn=mysql_connect("localhost", "userid", "password") or die(mysql_error());
$database=mysql_select_db("fback", $conn)or die(mysql_error());
$sql="SELECT * FROM customer_feedback ORDER by id DESC LIMIT 25"; $result=mysql_query($sql);

//PHP goes into while loop to return summaries of comments
while($row=mysql_fetch_array($result)){
   echo"<TR><td><B>Date: "
.strftime('%d/%m/%y',strtotime($row["date"]))."</B></td>

<td><B>Comment By:</B> ".Stripslashes($row["name"])."<td></tr>";

echo"<TR><TD COLSPAN=\"2\" valign\"top\"><B>Comment: </B>";

stripslashes(nl2br(cut_string($row["comment"],"10")));
echo"<a href=\"full_summ.php?id=$row[id]\">More>>> </a>";

echo"<hr></td></tr>";
}

//close database
mysql_close($conn);
?>
Oops - spotted it - try this


function cut_string($string,$wordnum,$trail)
   {
       $string_arr=explode(" ",$string);
       for($i=0;$i<$wordnum;$i++)

       {
           $re_string=" ".$string_arr[$i];
           $str=$re_string.$trail;
           print $str;
       }
    }


Pam




--
Jeremy Oliver
Bluejays PC Repair
tel 020 8656 1056
mob 07855833401
www.bluejayspc.co.uk

Reply via email to