I'm using Ckeditor to allow people to format text and then insert in database using mysqli parametized query as follow :
if (isset($_POST['editor1'])) {
$editor1 = htmlentities($_POST['editor1']);
//insert variables in table blog_post
$insert_blog_post_q= $conn->prepare("INSERT INTO blog_posts (blog_body) VALUES (?)");
$insert_blog_post_q->bind_param('s',$editor1);
$insert_blog_post_q->execute();
$insert_blog_post_q->close();
}
When I output the results it creates r\n
problems in between the paragraphs as follow
Hello im a title
r\n
More text
r\n
Text text
r\n
This problems will also creates back lashes in img src like this :
<img src='\"https://myimage.com"\'>
This will cause all the image links to be broken.
How can i fix this problem? Thank you