ie in MySQL storage Chinese lost problem, this world is too strange

Source: Internet
Author: User
First of all, my database and pages are UTF8 encoded, the page code is as follows:

Header ("Content-type:text/html;charset=utf8");
$result = $mysqli->query ("select * from ' Com_class ' where ' id ' =". $_get[' id ']);
if (! ( $result->fetch_row ())) {
echo "Data does not exist";
Exit
}
$mysqli->query ("Update ' Com_class ' Set ' name ' = '". $_get["Name"]. "' WHERE ' id ' = '. $_get[' id ']);
echo $_get[' name '];

In the Google browser and Firefox browser page normal display is not garbled, the data is also stored in the database.

In the IE9 page is also displayed normal, no error is not garbled, but the database is not saved to the data, the display is empty (not "?"). "such as garbled), if $_get[' name '] is in English, everything is OK, the database can also be stored normally.

Everybody talk about what's going on, front-end to take care of the browser I also understand that this storage database also takes care of different browsers?


Reply to discussion (solution)

Update ' Com_class ' Set ' name ' = ' ". $_get[" Name "]." ' WHERE ' id ' = '. $_get[' id '] does this statement succeed in the database execution?

Update ' Com_class ' Set ' name ' = ' ". $_get[" Name "]." ' WHERE ' id ' = '. $_get[' id '] does this statement succeed in the database execution?



Google and Firefox can be stored in the database normally, that means the implementation of the success of it


Update ' Com_class ' Set ' name ' = ' ". $_get[" Name "]." ' WHERE ' id ' = '. $_get[' id '] does this statement succeed in the database execution?



Google and Firefox can be stored in the database normally, that means the implementation of the success of it


You print the $mysqli->error look



Update ' Com_class ' Set ' name ' = ' ". $_get[" Name "]." ' WHERE ' id ' = '. $_get[' id '] does this statement succeed in the database execution?



Google and Firefox can be stored in the database normally, that means the implementation of the success of it


You print the $mysqli->error look



I tried, there's no problem.

In IE, English can be stored in the database normally, only Chinese will be lost, I think it should be not the problem of SQL statement, it should be the code and the like out of the problem, but I clearly database and PHP page with the UTF8 code, supposedly should not be wrong ah.

Do not see code to connect database and character set settings
As a test, you should print out the incoming data

Do not see code to connect database and character set settings
As a test, you should print out the incoming data



This code is included in the reference file, I do not write it here, the problem is that in other browsers the data can be stored successfully on the connection and SQL is certainly not a problem, don't you think so.

Still want to have a master or encounter this kind of question to answer.

Do not see code to connect database and character set settings
As a test, you should print out the incoming data



The data I pass in is only $_get["id" and $_get["name"]

What is the incoming data and is it "quoted"?
If you really want to solve the problem, it's best to provide as much information as possible

Do not see code to connect database and character set settings
As a test, you should print out the incoming data



$host = "localhost";
$user = "root";
$password = "";
$datebase = "Company";
$mysqli = new Mysqli ("$host", "$user", "$password", "$datebase");
/* Check the connection */
if (Mysqli_connect_errno ()) {
printf ("Connection failed:%s\n", Mysqli_connect_error ());
Exit ();
}
$mysqli->set_charset ("UTF8");

This is the code that connects the database and sets the character set, contained in another file, I includ the file's

The difference between IE and other browsers is that he strictly adheres to the rules.
That's why it's too late to be anti-monopoly.

What is the incoming data and is it "quoted"?
If you really want to solve the problem, it's best to provide as much information as possible



In addition to the 2 get did not pass any data, directly in the address bar input: Http://localhost/update.php?id=1&name= Zhang San, in Google and Firefox browser can normally save Zhang San in the database, IE9 the next page without any error prompts, Is that the database does not save any data, including the original data is not, just a null character

The difference between IE and other browsers is that he strictly adheres to the rules.
That's why it's too late to be anti-monopoly.



However, the storage data should not be related to the client browser, these are in MySQL execution of it

Because it's IE, so it's not surprising

Find the reason, IE9 address bar do not recognize Chinese characters, in the input data with encodeURI code it can be

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.