Inserting and reading data from a mysql TEXT field with php!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kunalm
    New Member
    • Jun 2007
    • 1

    Inserting and reading data from a mysql TEXT field with php!!!

    Hello
    I am trying to insert and then read some text from a textarea control, into a mysql TEXT field, with php. For that I am using simple php code for insertion of records.

    But the problem is that when I am fetching back the data some blank spaces are getting appended to the value that I am getting back from the text field. Is there any solve for it?

    Kindly provide some piece of code that can solve this problem. Thanks in advance.
  • Ajm113
    New Member
    • Jun 2007
    • 161

    #2
    What are you entering?

    Like "This isn't my dog!"

    This is a bad if you do not use stripslashes and mysql_escape_st ring in it. You can use real_escape, but mysql_escape_st ring works great for me. If its something like "This is a simple test sentance". Since it is not using a single quote it should work. This is usualy caused by your server. Its activating a anti mysql injection attack. So if you use mysql_escape_st ring and stripslashes in your $_POST['textarea_name']; or $_GET['textarea_name'];. You should be able to enter single quotes.

    [PHP]$text = stripslashes(my sql_escape_stri ng($_POST['textare_name']));[/PHP]

    hope this helps you!

    Comment

    Working...