Adding data to the database in a php file?It will be marked.

Asked 2 years ago, Updated 2 years ago, 52 views

If you add data to the database like this, when you display the table in mysql?It will be marked.

$sql="INSERT INTO tbladdress
            (name, prefid, address, tel)
          VALUES
            ("Serenagomez", 21, "Tokyo \", "04-XXXX-9999\";

Enter a description of the image here

In this way, before "Serenagomez" and before "Tokyo," ? are attached.What should I do? Can you prevent ? from appearing?

php mysql

2022-09-30 11:33

2 Answers

MySQL has character code settings.
The ? appears when the character code in the database does not match the character code of the client you are referring to.

If you do not intend to set it, you probably have a default character code.

To verify the configuration, use the

show variables like "character-set-server";

If so,

Values such as utf8 and sjis should appear.

I can't tell you exactly which character code you want to use because it depends on the usage, but I think it's important to set the character code to the intended code.

To configure
To my.conf

 [mysql]
default-character-set = character code

If you set up and restart MySQL, it will be reflected.
It is recommended that you do some research and set up the text code, as it may cause trouble in the future if you leave the text code roughly.


2022-09-30 11:33

Check the DB and table character sets and character codes.


2022-09-30 11:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.