MySQLi. PHP. GET. POST. Insert. Update. Delete. Segur SQL Inject

A user asked me how you could upload emoji to the database.
I tried this and it worked for me:

In file .php add this:
// 2.- Connection to the database.
$link = new mysqli($db_host, $db_login, $db_pswd, $db_name);
$link->set_charset('utf8mb4'); // ADD THIS