How to insert into SQL UTF8 / php?

You just need to modify something in your config.php that is running the sql connection.

Add after the $connection var:

1
mysqli_set_charset($connection, "utf8")

You should have something like this:

2
3
4
5
6
7
8
9
10
11
12
13
<?php
 
$db_address = "localhost";
$db_name = "domains";
$db_username = "root";
$db_password = "";
 
$connection = mysqli_connect($db_address, $db_username, $db_password, $db_name) OR DIE ("Can't connect to mysql");
 
mysqli_set_charset($connection, "utf8")
 
?>

It won’t matter if your sql table is not ut8_general_ci. The entries should still go as utf8.

ADD A COMMENT: