Sorrow Posted August 29, 2008 Share Posted August 29, 2008 Here is my problem. The website i am currently building is a movie reviews website. In the reviews and in the news and we need to write some text that is saved to the database. This is working fine and even in the database there is the carriage return but when i am displaying the text all the text is in one paragraph how can I keep the carriage return when I fetch the data from the database. Here is my code : <?php include 'opendb.php'; $query = "SELECT * FROM News ORDER BY newsid DESC"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<font face = 'Verdana'><table width='450' border = '0'> <tr> <td colspan ='2'><b>{$row['newsTitle']} </td> <td>{$row['Date']}</td> </tr> <tr> <td colspan = '2'>--------------------------------------------------------------------------------------------</td> </tr> <tr><td rowspan = '3'><img src='{$row['MoviePic']}'width='200' height='250' > <br>Director : {$row['Director']} <br> <br>Actors : {$row['Actors']} </td></tr> <td width ='300' colspan='2' align='justify'>{$row['News1']}</td> <tr><td><img src='{$row['Pic1']}'width='200' height='200' > <img src='{$row['Pic2']}'width='200' height='200' ></td></tr> <tr><td><td width ='300' colspan='2' align='justify'>{$row['News2']}</td></tr> </td> </tr> </table></font> "; } mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 29, 2008 Share Posted August 29, 2008 enter the nl2br() function: $text = "blah blah blah blah blah blah this n that stuff!"; echo $text.'<br />'; echo nl2br($text); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.