Link to home
Start Free TrialLog in
Avatar of Yuri Boyz
Yuri BoyzFlag for Uganda

asked on

PHP to mysqli db insertion issue

I have json which contains emoji emotions. I am trying to save it in DB but it cannot be inserted. My Db is UTF8 and also my collation is utf8.
Need help
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

You cannot save images in UTF8 you have to use UTF8mb4 .
https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

Change the table collation with something like

ALTER TABLE Tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
Avatar of Yuri Boyz

ASKER

let me check this and what will be character set of entire database?
You can also set a charset on a table basis or single column basis.
The character set will be UTF8 with support for BMP files.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.