SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting slashes from db

    I put some text into my db, using a php script, and then I pulled it back out, (CMS, duh!) but I has some funky slashes, and it isn't every where either, only preceding a ' in the word won't. I think I am just forgetting a function to get rid of thses, but why did I get 3? Check it out here: http://www.juniorsailing.com/tips/in...?zone=optimist it is the 2nd tip in the list.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Most likely because you have magic_quotes_gpc set to On in your php.ini file, so it automatically adds the slashes so it will get into the database successfully since a single quote would normally cause an error. To get rid of them before you display the variable run stripslashes() on it. Check out www.php.net/stripslashes for more information.


    PHP Code:
    $str stripslashes($str); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •