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

  • SEARCH
  • Home
  • 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 9222077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:43:45+00:00 2026-06-18T03:43:45+00:00

So I have an interesting issue that I have never come across and can’t

  • 0

So I have an interesting issue that I have never come across and can’t seem to find much information about correcting the issue. I have massive database that has an enormous amount of data in it (10 years worth), and attempting to search through it.

Now the search stuff works fine, but recently someone brought it to my attention about a ‘bug’ if you will. I’ve tried to trouble shoot it to get the expected results, but to no avail.

This is my issue:

When someone uses an apostrophe in the search, it’s not that the search faults out, But it returns no results. So for example when searching Pete's the query executes but returns nothing. Yes, I make sure the query has the mysql_real_escape_string() so that Pete's becomes Pete\'s.

Even when I try to query it using phpmysql’s search feature, I get strange results. The query is intended to be like this:

SELECT * FROM  `smd_article` WHERE  `copy` LIKE  '%Pete\'s%'

But when I use the search feature in phpmyadmin, it gives me:

SELECT * FROM  `smd_article` WHERE  `copy` LIKE  '%Pete''s%'

And when I actually type out the query in the sql tab, it still returns no results. But there are some 17K records that get returned when I just use Pete and some 3k records when I do just Petes.

So I am curious as to what I am doing wrong, or missing to make it so that it can allow for the apostrophe in a query using the LIKE statement. Thoughts?

  • 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-18T03:43:47+00:00Added an answer on June 18, 2026 at 3:43 am

    try by mysql_real_escape_string

    LIKE '%" . mysql_real_escape_string($find) . "%' 
    

    or

     LIKE  '%Pete%27s%'
    

    or if you are using pdo you can do like

    $search ='Pete\'s'
    $stmt = $db->prepare("SELECT * FROM  `smd_article` WHERE  `copy` LIKE ?");
    $stmt->bindValue(1, "%$search%", PDO::PARAM_STR);
    $stmt->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of the most interesting issue that I have come across in
I ran across an interesting issue today. We have an application that utilizes Zend
I am designing a contact management system and have come across an interesting issue
So I have an interesting issue. I have a page that allows users to
I have an interesting issue where a class inherits from a class that implements
I am facing an interesting issue: Currently I have a button that says Print,
I have an interesting issue that only happens in IE9. There are some forms
I have encountered an interesting issue on Windows 8. I tested I can represent
Today I encountered interesting issue. That's what I have: 2 images with humanoids on
This is quite an interesting issue I'm having with z-indexes that I've never encountered

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.