SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot XandroZ's Avatar
    Join Date
    May 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql escaped character

    I need to insert a text into a Mysql table with php.The text contains ',";
    So I tried mysql_escape_string or mysql_real_escape_string functions.

    The problems is with this type of string,for example:
    Code:
    Nancy's dog
    and after I applied the function
    Code:
    Nancy\'s dog
    (escaped), but mysql doesn't recognize the escaped character.

    I have :
    # MySQL 5.1.33
    # PHP 5.2.9

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You are doing everything correct. The string, when it's part of the database query, should look as you said

    Code:
    Nancy\'s dog
    When you retrieve it from the database, the backslash won't be there, which is what you want (to get back what was typed, not the escaped string)


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
  •