Results 1 to 3 of 3

Thread: Getting rid of backslashes

  1. #1
    Join Date
    Jul 2010
    Location
    Near Albany, NY
    Posts
    56
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Getting rid of backslashes

    I have a very simple program that, in its output, inserts a backslash before every apostrophe and before every quotation mark (whether single or double). For example: He will call you after he/'s finished the laundry. He said, /"The minute I/'m finished./"

    I've read about this and I know it has to do with 'escaping'. And I've read about Magic Quotes and/or stripslashes() but I've never entirely understood either of those and never managed to get rid of these ^&&()^%% backslashes.

    The relevant line of code seems to be: echo $row['notes'];

    I'm using PHP 5.3.27 .

    Do I just add stripslashes() somehow?

    echo stripslashes($row['notes']); -- would that work? I have no idea what the proper syntax would be.
    Last edited by Anne Arbor; 01-23-2014 at 02:18 AM.

  2. #2
    Join Date
    Jul 2010
    Location
    Near Albany, NY
    Posts
    56
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Hey, I edited my code, as described above, and it worked! Not only took the backslashes out of my new entry, but deleted them from every previous entry made during the past two years.

    Okay, do I get to give myself "Thanks" for having solved the problem? Just wondering. :-)

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,734
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    You should have a file in your root directory or above called php.ini or php5.ini depending on your hosting configuration. When you open the file you will see some options for disabling the magic quotes. I changed mine to the following:

    magic_quotes_runtime = off
    magic_quotes_sybase = off
    magic_quotes_gpc = off

    If those lines are not present at all you can add them. See

    http://www.php.net/manual/en/securit....disabling.php

    for more information.

    Oddly enough we were able to give ourselves thanks in the previous version of vBulletin here on the forums . If you do come up witha cool trick or solve your own problem like above I would encourage you to leave your solution for others to find.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. The Following User Says Thank You to james438 For This Useful Post:

    Anne Arbor (01-23-2014)

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
  •