How to insert Hindi in MySQL database using PHP, now am getting question mark

Run below SQL query to check default character set

SHOW VARIABLES LIKE ‘character\_set\_%’;

Variable_name             Value
character_set_client      utf8mb4
character_set_connection  utf8mb4
character_set_database    latin1
character_set_filesystem  binary
character_set_results     utf8mb4
character_set_server      latin1
character_set_system      utf8

here the character_set_database value is latin2 To insert Hindi in MySQL database using PHP, we need to update character_set_database value to utf8 ,ALTER DATABASE and change the DB character and set it to utf8 COLLATE utf8_bin

ALTER DATABASE DB_NAME CHARACTER SET utf8 COLLATE utf8_bin

Leave a Reply

Your email address will not be published. Required fields are marked *