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 8710175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:33:29+00:00 2026-06-13T04:33:29+00:00

— Sytem is MySQL, PHP, Apache and the code is built around the Codeigniter

  • 0

— Sytem is MySQL, PHP, Apache and the code is built around the Codeigniter Framework

EDIT FOR CLARITY: I am not storing data, I am trying to retrieve data that was stored some years ago (badly as escaped data). In the database the name Fred’ is stored as Fred&#39 yet when I convert Fred’ using htmlspecialcahrs it comes out as Fred&#039. My question is what do I need to do to make Fred’ convert to Fred&#39 and any other equivalents?

Original Question

I’ve inherited a database from another system (Invision Power Board to be exact). The site is now custom coded using Codeigniter but is using the same member database from the old Invision Power Board site.

I’ve now discovered a problem where by if a user has an apostrophe in their name e.g. “Fred'” codeigniter’s built in html_escape function (which just uses htmlspecialchars) converts it to Fred&#039

Yet in the database the name is saved as: Fred&#39 and thus the lookup fails.

I’m not sure what Invision Power Board was doing to the string before inserting it into the database, but does anyone have any idea how I could ensure that it is converted to &#39 instead of &#039 ?

Simply saying do a str_replace or change the data in the db is not useful as there are hundreds of possibilities for what could be in a users name. A quick search for users with a # in their name (presumably a special char) shows up 440 users who are currently unable to login due to this bug in our site.

EDIT: Fixed some formatting to remove “;” so it doesn’t just display an apostrophe

  • 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-13T04:33:30+00:00Added an answer on June 13, 2026 at 4:33 am

    You can use preg_replace() to remove 0’s from php generated string before comparison:

    $string = 'Fred&#039';
    
    $string = preg_replace('/&#0+([1-9]+)/', '&#$1', $string);
    
    var_dump(str_split($string));
    // str_split to show real result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a DatePicker ( org.apache.wicket.extensions.yui.calendar.DatePicker — Javadoc ) in a form. The form
For the following SQL I get the error: Data truncation occurred on a write
I'm creating a FORM with PHP for an intranet webpage. Another PHP script is
All of my code is on my SVN, but I want some of it
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
Is there an already built-in, standard way in JMock to capture method arguments to
&mdash; or &#8212; Is there a difference between these? Is one better-supported than the
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
How can I get the current Android view when it displays data that has
I need a function that will clean a strings' special characters. I do NOT

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.