#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    14
    Rep Power
    0
    Hi I had posted a problem regarding inserting a comment line into my database(using php/mysql).
    Well, that problem has been solved (thanks) but a new problem has cropped up.

    The initial problem was solved by using this little tip:

    before inserting to the table use
    urlencode() function..

    <?
    $comment=urlencode($comment);
    ///then insert this..
    ?>

    AND

    When you retreive value from the database..
    Use urldecode() function and stripslashes() also..


    ---

    <?
    $comment=urldecode($comment);
    //decode it
    $comment=stripslashes($comment);
    // remove slashes
    echo $comment;
    ?>

    BUT NOW...
    it works fine for a one line comment like:
    this is a comment line
    BUT
    if I do something like:
    this is line one
    this is line two
    it barks and tells me that an error occured?
    I also tried to clean it up with the nl2br function and it still didn't like it!!

    So my question is how can I stick a multiple line comment into my field?

    Once again thanks for the help

    Mike
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You don't have to stripslashes() upon querying the table. The slashes are used to make the insert work properly, they aren't stored as part of the data. Try it without the stripslashes(), I have an idea that might help.

Similar Threads

  1. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 03:21 PM
  2. fread problem: doesn t compile php code
    By ghorghor2002 in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 06:25 AM
  3. Wierd problem inserting data with VB6
    By gregquinn in forum MySQL Help
    Replies: 5
    Last Post: February 2nd, 2004, 08:37 AM
  4. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 05:13 AM
  5. Session Variable problem :(
    By modesty in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 05:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo