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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:56:45+00:00 2026-05-28T03:56:45+00:00

I am creating an application using CodeIgniter/MySQL. The problem is that when I store

  • 0

I am creating an application using CodeIgniter/MySQL. The problem is that when I store a text with Quotes or Apostrophe. It stores an Blank value to MySQL database.

function add_article($title, $desc){
        $data = array(
            'title' => htmlentities($title, ENT_QUOTES, "UTF-8"),
            'desc' => htmlentities($desc, ENT_QUOTES, "UTF-8")
        );
        if($this->db->insert('articles', $data)){
            return TRUE;
        } else {
            return FALSE;
        }
}

The character set of my table “articles” is “utf8” and COLLATE is utf8_unicode_ci. And HTML character set is also UTF-8. what’s wrong? Please help me, and thanks in advance. If i don’t use htmlentities() function i face two problems which i mention in my comments below:

  • 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-05-28T03:56:45+00:00Added an answer on May 28, 2026 at 3:56 am

    You could have problems either on input or on output.

    On Input

    First of all, make sure that the string you receive actually is utf-8.

    • If you received the data from a form, add accept-encoding="utf-8" to the form element.
    • Verify that your input string could be a valid utf-8 stream with TRUE===mb_check_encoding($string, 'UTF-8')
    • Check that the byte sequence is as expected by counting characters: mb_strlen($string, 'UTF-8') should return the same number of characters as what you see, and a number less than strlen($string) (which counts bytes).

    In your application/config/database.php, ensure you have these two settings for your database connection:

    $db[$dbgroupname]['char_set'] = "utf8";
    $db[$dbgroupname]['dbcollat'] = "utf8_unicode_ci";
    

    Replace $dbgroupname with the group name of your connection (e.g., 'default').

    Don’t use htmlspecialchars or htmlentities on data before you store it. Use those on output, in your views.

    On Output

    Ensure that whatever you are using to view the data that comes out of your database expects a utf-8 encoding.

    For html, make sure your Content-Type header includes charset=utf8 and your html document’s head looks like this:

    <head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    Check your results in multiple browsers. Some browsers do charset sniffing and might choose a different charset than what you declare. If so, this means that something on your page is not valid UTF-8–find that thing and eliminate.

    If you are using some kind of database viewer (PHPMyAdmin, Navicat, etc), make sure the connection is configured to expect utf-8.

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

Sidebar

Related Questions

I'm creating an application (using PHP / Codeigniter / MYSQL) for tracking volunteers at
I'm creating a database application using ASP.NET and I want to make a Windows
I'm looking for an introduction in creating application using CodeIgniter and Integrating it to
I am creating a application using jmf that will be launched on a user's
I am creating an application using c# and database in webserver.while accessing data from
I could use some help on this problem. I'm creating an application using Symfony2
I am creating application in AIR using JavaScript. Many of my functions requires text
Currently, I am creating an application using ASP.NET MVC3 and MySQL and when I
In codeigniter I am creating an application that allows the user to upload multiple
Suppose I am creating a application using the sample Northwind database using asp.net mvc

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.