Closed Thread
Results 1 to 2 of 2

Thread: MySQL escaping

  1. #1
    phillw's Avatar
    phillw is offline Learning Programmer
    Join Date
    Aug 2009
    Location
    Northwest England (UK)
    Posts
    82
    Blog Entries
    1
    Rep Power
    0

    Unhappy MySQL escaping

    It has sorta been drilled into me to use mysql_real_escape_string when dealing with input from users.

    On the site in question, I do have this all set up, however, as part of a tutorial series on FULLTEXT, I've included the output of both "un-escaped" and "escaped" input, to show the importance.

    Imagine my surprise when I input
    'E'
    via
    Code:
    echo '<form id="input" action="search.php" method="get" />';
    echo 'I am Looking For:  ';
    echo '<input type="text" size="40" name="LookFor" />';
    echo '<input type="submit" value="Go Find It !!" />';
    and find that
    Code:
    $LookFor=$_GET['LookFor'];
    returns
    \'E\'
    BEFORE is run it through the mysql_real_escape_string command, which then thoroughly enjoys itself and returns
    \\\'E\\\'


    Has someone changed the rules and not told me ??

    As you can imagine, it's playing havoc with my trying to put the MySQL query string together !!!

    I'm sure I was told not to use strip-slashes on input, but it looks like either I should do, or drop the mysql_real_escape_string bit

    Mr O'Riley is going to be much dis-pleased...

    Regards,

    Phill.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    phillw's Avatar
    phillw is offline Learning Programmer
    Join Date
    Aug 2009
    Location
    Northwest England (UK)
    Posts
    82
    Blog Entries
    1
    Rep Power
    0

    Re: MySQL escaping

    GRRRRR...

    I've found out that magic_quotes_gpc are turned on by deafult -- I'm now heading over to trace the person responsible and kill them.

    Phill.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-20-2010, 12:38 AM
  2. [C#]MySQL] Host '****' is not allowed to connect to this MySQL server
    By ZaroX in forum Database & Database Programming
    Replies: 2
    Last Post: 02-16-2010, 08:34 PM
  3. Blocking GUI Movement escaping ur app
    By MXTECH in forum Visual Basic Tutorials
    Replies: 3
    Last Post: 07-02-2008, 08:48 PM
  4. AJAX - Escaping (
    By Lop in forum JavaScript and CSS
    Replies: 4
    Last Post: 08-18-2007, 06:01 AM
  5. AJAX - Escaping (
    By Lop in forum AJAX
    Replies: 4
    Last Post: 08-18-2007, 06:01 AM

Tags for this Thread

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