Submit Your Article Forum Rules

Results 1 to 2 of 2

Thread: mysql_real_escape_string Not Working When Querying The Database

  1. #1
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Question mysql_real_escape_string Not Working When Querying The Database

    OK I will do my best to explain this problem that I believe mysql_real_escape_string should resolve but it's not.

    Now, at this particular website if I post content with single quotes like "they're" it goes to the data base nicely because of the help of the mysql_real_escape_string php function.

    If I look in the database the content is there, nicely...with the strings that contain the single quotes.

    BUT! when I try to retrieve the data an error is thrown and the data does not show up on the page it usually would and will if the content does not contain a single quote.

    Before showing you the code I"m dealing with, is there something simple that the php/database experts can help me fix in seconds? Does the database settings have to be revised?

    I hope this isn't one of those problems that's going to kill me figuring out!

    Every bit of help is appreciated.

    Thanks everyone!
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  2. #2
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249
    OK the code, I can give you this to see the SQL statement, maybe this will help the matter...

    Code:
    $postContent = myQ("
                SELECT `id`,`topic`,`subject`,`user`,`body`
                FROM `[x]blogspot`
                WHERE `id` = '{$_GET["id"]}'
                LIMIT 1
            ");
    In the case above, how will I make sure the content will display when it encounters an error selecting the body field's content? (which has the content with a single quote). Everything get's put into the $postContent array...
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

Tags for this Thread

Posting Permissions

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