Re: PHP Snippet on a web page
| From: | Paul Reinheimer | Date: | Tue, 14 Mar 2006 01:25:10 +0000 |
| Subject: | Re: PHP Snippet on a web page | ||
| References: | 1 2 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-17176@lists.php.net to get a copy of this message | ||
Two problems in your code:
1)
for($i=0;$i<$wordnum;$i++)
{
$re_string=" ".$string_arr[$i];
}
Should be
for($i=0;$i<$wordnum;$i++)
{
$re_string .= " ".$string_arr[$i];
}
Notice it's .= rather than =. You want to add to what you had already.
2)
cut_string($row["comment"],"1/10","<a
href=\"full_summ.php?id=$row[id]\"> Read More>>></a>");
should just be
cut_string($row["comment"],10,"<a href=\"full_summ.php?id=$row[id]\">
Read More>>></a>");
You're not using the 1 anywhere, and it can only confuse your for
loop. Now it's also an integer, not a string.
paul