Augmented Test Code for Functionality Check
In the previous lesson, I provided you with test code to check the general functionality. Let's augment it taking into account the described rules for working with encodings:
<meta charset="utf-8">
<?php
$host = 'localhost'; // hostname
$user = 'root'; // username
$pass = ''; // password
$name = 'mydb'; // database name
$link = mysqli_connect($host, $user, $pass, $name);
mysqli_query($link, "SET NAMES 'utf8'");
$query = 'SELECT * FROM users';
$res = mysqli_query($link, $query) or die(mysqli_error($link));
var_dump($res);
?>
In the following lessons, for brevity, I will not provide all this code, and will show only the query sending code. But keep in mind that you should have the full code.