Your Ad Here

Home » PHP Code »

1

When we dealing with a text area in the PHP application ,

for Example in your application given that About me feild,

suppose some of the users may given that “This is about Anil’s blog”.

When we try to insert into database then we got the some errors.

To avoid that error and insert into database without any errors:

1
2
3
$text = addslashes($text);

// $text is contents of text area.

To add the line breaks at time of insert into database:

1
2
3
$test= "This
        test
        message"
;

so insert as it is format then put below line of code when time of insert:

1
$text = nl2br($text);

Thank You.


You may like these posts

    Events calendar implementation in oscommerce using php codeHow to take backup of Database using PHP code?How to remove consecutive whitespaces using php?What is cron job ? How to set the cron job in PHP?

 

1 Comment

Leave a Reply