www.webdeveloper.com
Results 1 to 3 of 3

Thread: Two anti slashes too many

  1. #1
    Join Date
    Jan 2012
    Posts
    6

    Two anti slashes too many

    hello

    In one of my Web page, the user keys in:
    Code:
    <img src='../esp1/commun/symboleS/6h.png'>
    in a field named nom.

    Before writing this into MySql, I normalize the value with:
    Code:
    $nom = mysql_real_escape_string($nom);
    
    When I go and look into MySql via PhpMyAdmin, the column contents:
    Code:
    <img src=\'../esp1/commun/symboleS/6h.png\'>
    How could I avoid these 2 extra anti slashes?

    Thank you in advance for your help.

    Francois

  2. #2
    Join Date
    Mar 2011
    Posts
    1,156
    When you retrieve the values from your MySQL database, use stripslashes() in your PHP script, as in:
    Code:
     $nom = stripslashes($row['nom']);
    That will remove the slashes inserted by mysql_real_escape_string(). Good luck!

  3. #3
    Join Date
    Jan 2012
    Posts
    6
    hello

    Yes, the stripslashes() did the work just perfectly.

    Thank you for your kind help.

    Francois

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles