SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot sethtrain's Avatar
    Join Date
    Dec 2003
    Location
    Paducah, KY
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting a \' when information is output from database

    I am getting a \' when my data is output from the mySQL database.

    Example:
    I\'ll be there...

    Can anyone tell me why? I figure it has something to do with how i am putting the information into the database. I have a function called add slashes and probably shouldn't.

    Thanks
    --
    sethtrain

  2. #2
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you use addslashes, and you have have magic_quotes turned on, then you'll escape your quotes twice, so they will end up in the db with an extra \.

    You *can* use stripslashes when taking something out of the db but you should check to see if magic_quotes is when when entering stuff in the db. Check out the first post in the thread below for info on how to do that.

    http://www.sitepointforums.com/showthread.php?t=54074

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have a problem regarding magic quotes.
    A quick solution would be to use strip_slashes() on the data from the db.
    However this should be dealt with upon insert it into db.
    Check out the magic_quotes, addslashes(), and stripslashes() part of the first post in thread PHP and MySQL coding tips .

    HTH

    -Helge

  4. #4
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your FACE Helge

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    I have to get faster...
    *faster, faster, faster, faster, faster, fatser, .....*

  6. #6
    SitePoint Zealot sethtrain's Avatar
    Join Date
    Dec 2003
    Location
    Paducah, KY
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much. The stripslashes() worked. I think my problem was that I have magic_quotes and then used addslashes(). I forgot all about magic_quotes.
    --
    sethtrain


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •