I'm trying tp display Emojis from my database to Web Browser. I tried to input emoji from my phone to my app and it is saved to database as 'ðŸ˜'. How can I display it to PHP as emoji like this
You need to configure your database connection like the following:
$db = new mysqli('localhost', 'username', 'password', 'db_name');
if ($db->connect_error) {
die("Connection failed: " . $db->connect_error);
}
$db->query("SET character_set_client='utf8mb4'");
$db->query("SET character_set_results='utf8mb4'");
$db->query("set collation_connection='utf8mb4_bin'");
And ensure your HTML file is UTF-8, have the following in between the head tags:
<meta charset="utf-8">
Hope it helps. Cheers!