I use a form to write an article and then save it into the mysql table.
I use this to save it:
$Db_profile = safe_sql($_POST['x_profile']);
and the function safe_sql is:
I save it with a normal insert:
When I come to display the article all the sentences just get pushed together,the line breaks have al gone.
I use this to display it:
The strange thing is, when I look at the table data it still contains the line breaks so it must be my display method that is causing the problem.
What am I doing wrong ?
I use this to save it:
$Db_profile = safe_sql($_POST['x_profile']);
and the function safe_sql is:
Code:
// Make variable SQL safe
function safe_sql( $value )
{
$value = strip_tags(trim($value));
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = mysql_real_escape_string($value);
}
return $value;
} // End of Function
Code:
$sql = "UPDATE clients SET
profile = '$Db_profile',
last_date = '$today'
WHERE user_id = \"{$_SESSION['expert']}\" ";
mysql_query($sql) or die("could not execute PROFILE update query". mysql_error());
I use this to display it:
Code:
<div class="hot04"> <p><?php echo "$profile"; ?></p> </div> <!-- End div:hot04 -->
The strange thing is, when I look at the table data it still contains the line breaks so it must be my display method that is causing the problem.
What am I doing wrong ?
Comment