08-07-2009, 02:44 PM
|
#4 (permalink)
|
|
The Contributor
Join Date: Jul 2009
Posts: 80
Thanks: 13
|
Fixed the error, however need some help
Code:
<?php
while($row = mysql_fetch_array($result))
{
$sitename = $row['sitename'];
$title = $row['title'];
$body = $row['body'];
}
$position=300; // Define how many character you want to display.
$post = substr($body,$position,1); // Find what is the last character displaying. We find it by getting only last one character from your display message.
if($post !=" "){ // In this step, if last character is not " "(space) do this step .
// Find until we found that last character is " "(space)
// by $position+1 (14+1=15, 15+1=16 until we found " "(space) that mean character 20)
while($post !=" "){
$i=1;
$position=$position+$i;
$post = substr($body,$position,1);
}
}
$post = substr($body,0,$position); // Display your message
print $sitename;
echo "<br/>";
echo $post;
echo "...";
echo "<br/><br/>";
?>
Now my issue is this part of the code needs to be duplicated
Code:
print $sitename;
echo "<br/>";
echo $post;
echo "...";
echo "<br/><br/>";
Is there any way to do this?
Thanks
|
|
|
|