Saving data in MYSQL is almost common in every website. When it comes to unicode date there is a bit of overhead that needs to be taken care of. I am listing those settings step by step.
1. Set table's collation to "utf8_general_ci"
ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
2. Set the column's collation to "utf8_general_ci"
ALTER TABLE <table_name> MODIFY <column_name> VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
3. In PHP use the below code while the data is being inserted into the table.
mysqli_query($conn,"SET names 'utf8'");
No comments:
Post a Comment