Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:36:34+00:00 2026-06-05T03:36:34+00:00

I am writing comments from my website in my database with PHP using mysql_real_escape_string()

  • 0

I am writing “comments” from my website in my database with PHP using mysql_real_escape_string(). this will escape stuff out, as well as single-quote (‘) and double-quotes (“). when I load these comments back into my website, I’m using AJAX to load them, triggered by the scroll bar of a DIV to load 5 more on each scroll bar that reached bottom of DIV.

Everything works fine until an entry containes escaped \’ (single-quote)

var ajax_entry_items = JSON.parse(http.responseText);

the JSON.parse function gives the error

Uncaught SyntaxError: Unexpected token ‘ in Google Chrome.

How can I still input single-quotes and double-quotes in my comments in my database and bring them back to display them on the website ? The double-quotes and single-quotes come back escaped but for some reason the single-quote, escaped, generates the

Unexpected token” error.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:36:37+00:00Added an answer on June 5, 2026 at 3:36 am

    It is not allowed to enclose strings in single quotes, nor to escape single quotes, in JSON. You must escape double quotes and must not escape single quotes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing to clarify some comments on this website. 1) I know that
Writing a python program, and I came up with this error while using the
Following on from a discussion which got going in the comments of this question
I'm about to start writing a program which will attempt to extract data from
I'm writing a quick preg_replace to strip comments from CSS. CSS comments usually have
I'm writing a tool the retrieves data from an Oracle database. The majority of
I'm writing specs for a page where there will be a Facebook comments plugin
I am writing this comment class: class Comment { public $id; public $post_id; public
i am developing a website on writing reports ...users can comment on a report
Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.