Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Include line breaks

Author  Topic 

g.farmer
Starting Member

1 Post

Posted - 2013-02-06 : 12:28:09
Hi everyone

I am wondering if you could help. I have zero experince with both SQL & PHP.

I have put together a webform. When a user puts the text in the text area and creates a new paragraph using the the return key, it ends up in my databas as one line and so is bieng outputted as one line.

I am getting the following error

Warning: Wrong parameter count for str_replace() in /home/a2417904/public_html/joybells/posted1.php on line 12

I have spent the last few days looking on line but have ony found the solution which has not worked. Here is my code.

<?php

include ('connections/connect.php');

$title = $_POST['title'];
$content = $_POST['content'];
$author = $_POST['author'];


$new_blog = "INSERT INTO Blog (Title, Content, Author, Date) VALUES ('$title', '$content', '$author', CURDATE())";
$enter_query = mysql_query($new_blog) or die (mysql_error());
$new_blog = str_replace("<br />","\n");

?>

The line in question is in bold.

Any help would be appreciated.

Many thanks

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-02-07 : 01:45:04
It might be worth asking this question at a PHP forum ,

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -