Forum Moderators: coopster
$text = htmlentities($text);
echo '<p>'.ereg_replace("(\r\n¦\r¦\n)","</p><p>",$text).'</p>';
I'm not a regular expression expert, but I think the above should match a newline regardless of the client machine.
What this is supposed to do is to replace all occurences of a newline with paragraph tags.
The first line also protects you from people entering HTML code in the text field.
# START THE TABLE INFORMATION FOR THE RESULTING INFORMATION
echo '<table cellpadding=0 spacepadding=0 border=1 bordercolor="#FFFFFF" width=100%><tr>';
# BEGIN THE SQL QEURY FOR THE INFORMATION
# SHOW ALL THE CONTENTS
$result=mysql_db_query($base,"select * from ".$basesites." WHERE `id` = '2'",$link);
if ($result > 0)
{
$num4=mysql_num_rows($result);
if($num4!=0)
{
$n=0;
while ( $n<$num4 )
{
# call and show the date
$date=mysql_result($result,$n,"date");
# call and show the tilte
$title=mysql_result($result,$n,"title");
# call and show the vedette
$vedette=mysql_result($result,$n,"vedette");
# call and show the text
$text=mysql_result($result,$n,"text");
# call and show the sit url
$genre=mysql_result($result,$n,"genre");
# call and show the sit url
$age=mysql_result($result,$n,"age");
# call and show the sit url
$site=mysql_result($result,$n,"site");
# call and show the sit url
$image_site=mysql_result($result,$n,"image_site");
$n++;
if (!$size) $size="0 kb";
echo "<tr bgcolor=709C9D><div align=right><font color=#FFFFFF size=-1><b>$date</b></font></div></tr>";
echo "<tr><div align=left><font color=#000000 size=-1><strong>$title</strong></font></div></tr>";
echo "<tr><div align=left><font color=#000000><BR>$vedette</font></div></tr>";
echo "<tr><div align=left><font color=#000000><BR>$text</font></div></tr>";
echo "<br><tr><div align=left><font color=#000000>$genre<br><br><img src=$age width=25 height=25> <a href=$site target=_blank><img src=$image_site width=100 height=25 border=0></a></font></div></tr>";
}
}
echo "</table>";
}
Is the field you are having problems with named text?
Assuming it is, then right after
$text=mysql_result($result,$n,"text");
$text = '<p>'.ereg_replace("\n","</p><p>",$text).'</p>';
This should do what you want.
I simplified the search expression to eliminate potential errors.