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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:58:41+00:00 2026-06-17T13:58:41+00:00

The cookie is encoded using the big5 set, and it cannot insert into MySQL.

  • 0

The cookie is encoded using the big5 set, and it cannot insert into MySQL. Could you help me to solve this problem?

Fields: username is eng, date1 is date, reason1 is a Chinese character.

$reason1 = $_COOKIE["reason"];
$sql2="INSERT INTO 
    attendance_count(username,date,count_time,appendix) 
    VALUES ('$username','$date1','0','$reason1')";
mysql_query($sql2);
  • 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-17T13:58:42+00:00Added an answer on June 17, 2026 at 1:58 pm

    Use UTF-8 when you create table.

    create table table_name () CHARACTER SET = utf8;

    Use UTF-8 when you insert to table

    set username utf8; INSERT INTO table_name (ABC,VAL);

    Read More

    And More

    Detailed Code

    Below code is tested code please do the following its works.

    If you have already created database please ALTER it as below code.
    And if you didn’t created database then create it and set Collation to utf8_unicode_ci

    And same for table define Collation as “utf8_unicode_ci” for table fields in which you want to store chines chars.

    ALTER DATABASE `stackoverflow` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    
    CREATE TABLE `stackoverflow`.`chines`
    (
        `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
        `words` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
    ) ENGINE = InnoDB;
    <?php
    
        define('HOSTNAME', 'localhost');
        define('USERNAME', 'root');
        define('PASSWORD', '');
        define('DATABASE', 'stackoverflow');
    
        $dbLink = mysql_connect(HOSTNAME, USERNAME, PASSWORD)or die(mysql_error());
        mysql_query("SET character_set_results=utf8", $dbLink)or die(mysql_error());
        mb_language('uni'); 
        mb_internal_encoding('UTF-8');
        mysql_select_db(DATABASE, $dbLink)or die(mysql_error());
        mysql_query("set names 'utf8'",$dbLink)or die(mysql_error());
    
        if(isset($_POST['addWord']))
        {
            mysql_query("SET character_set_client=utf8", $dbLink)or die(mysql_error());
            mysql_query("SET character_set_connection=utf8", $dbLink)or die(mysql_error());
    
            $sql_query = "INSERT INTO chines(words) VALUES('".$_POST['words']."')";
            mysql_query($sql_query, $dbLink)or die(mysql_error());
        }
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <title></title>
    </head>
    <body>
        <?php
            mysql_query("SET character_set_results=utf8", $dbLink);
            $sql_query = "SELECT * FROM chines";
            $dbResult = mysql_query( $sql_query, $dbLink)or die(mysql_error());
    
        ?>
    
        <form action="" method="post">
    
            <p>Word : <input type="text" name="words" /></p>
            <p><input type="submit" name="addWord" /></p>
    
        </form>
        <?php
            while($row = mysql_fetch_assoc($dbResult))
            {
                echo $row['words']. '<br />';
            }
        ?>
    </body>
    </html>

    See the result and step visual as below.

    enter image description here

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

Sidebar

Related Questions

I got this cookie returned from web-server in Set-Cookie header: PHPSESSID=462rutd8g0sbg9sinh3hqa2ol6; path=/,wordpress_test_cookie=WP+Cookie+check; path=/,wordpress_ca07030412dd7fcd4dbeaae0bd9f5df9=testemail@example.com; expires=Sun,
I am using Jquery Cookie but am having difficulty setting and retrieving the info.
A HTTP Cookie consists of a name-value pair and can be set by the
When storing a value in a cookie using C#, what is the best way
The IETF recommends using base64 encoding for binary cookie values: https://datatracker.ietf.org/doc/html/draft-ietf-httpstate-cookie-07 So I use
I want to create a cookie with: Name: drm Value: drmStatus=Expected I'm using the
I am using PHP to save the values of a form as JSON into
I am running into an issue playing a properly encoded video on an iOS
This is a weird issue. I have a mashalled object(cookie), an array with 2
I'm trying to send a base64 encoded data using a POST request and it

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.