Quick tip post.   If you have set your data in MySQL to be utf-8 and have special characters such as umlauts (ö) and accents (é) then ensure you add the following:


mysqli_set_charset($mysqli, "utf8");

This could be added to your connection information as follows:


$mysqli = new mysqli($hostname, $username, $password, $database);
mysqli_set_charset($mysqli, "utf8");

This sets the character set used in the msqli method to utf8.  If this isn't done then data containing some special characters will be returned as null.

Leave a Comment