Slashes in database data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziycon
    Contributor
    • Sep 2008
    • 384

    Slashes in database data

    When i submit data to the database like the example below:
    "Sean's car is broken"
    It ends up like this in the database:
    \"Sean\'s car is broken\"
    How can i stop this from happening?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Sounds like you've got magic_quotes turned on.

    Comment

    • ziycon
      Contributor
      • Sep 2008
      • 384

      #3
      So i just get my host to turn it off, if they wont turn it off, is there any other way to fix it?

      Will putting this into the .htaccess file work:
      php_flag magic_quotes_gp c off

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by ziycon
        So i just get my host to turn it off, if they wont turn it off, is there any other way to fix it?

        Will putting this into the .htaccess file work:
        Yes, and you just told me it. :)

        Comment

        • ziycon
          Contributor
          • Sep 2008
          • 384

          #5
          Is there any draw backs or knock on effects from turning off magic quotes?

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by ziycon
            Is there any draw backs or knock on effects from turning off magic quotes?
            No, apart from it not escaping your data with slashes. It's being dropped from PHP completely in PHP 6 - signaling it's pointlessness.

            Comment

            • ziycon
              Contributor
              • Sep 2008
              • 384

              #7
              Cool, thanks for that.

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                For more fun with magic quotes:
                PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

                Comment

                Working...