Thanks Abduraooft for the reference and the PS: I will not crosspost again. I have however not grasped the use of nl2br() function. Where do I use it? Do I use it when I am inputting data into the database or when displaying in a browser? Below are the codes in my website that perform the aforementioned tasks (the particular table column I want paragraphed is in red). Please guide me on how I can make use of the nl2br() function.
INSERTING:
Code:
$sessionvariable = $_SESSION['names'];
$title = $_POST['title'];
date_default_timezone_set('Africa/Nairobi');
$datetime = date('Y/m/d H:i:s');
$stories = $_POST['stories'];
mysql_query("INSERT INTO `a5846646_4f2005`.`stories` (
`id` ,
`names` ,
`Title` ,
`datetime` ,
`stories`
)
VALUES (
NULL , '$sessionvariable', '$title', '$datetime', '$stories'
)");
RETRIEVING FOR DISPLAY ON BROWSER:
Code:
$id = $_GET['id'];
$sql = "SELECT * FROM `stories` WHERE `id` ='$id' ";
$result = mysql_query($sql) or die(mysql_error());
//display story data
while($row = mysql_fetch_assoc($result))
{
echo '<h2>Story title: ' . $row['title'] . '</h2><br>';
echo '<h2>By: ' . $row['names'] .'</h2>';
echo '<h2> on ' . $row['datetime'] . '</h2><br>';
echo 'Story: ' . $row['stories'] . '<br>';
}
Thank in advance for your assistance.
Quote:
|
Who said nothing is impossible while I have been doing nothing all this time?
|