I have a php file that inserts data to a mysql db using pdo. When I try to insert the word référencé in a field in one of my table, it is showing in mysql like référencé
I do not get it as I specified a little everywhere the charset as utf-8. See below.
- my table is set to innodb utf-8
- my field is set to utf8_general_ci
- at the top of my php script i put
a.header('Content-Type: text/html; charset=utf-8');
b.mysql_set_charset('utf8');
c.mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
Here below my pdo connexion function:
function connexion($host, $user, $pass, $db){
$db_host = $host;
$db_user = $user;
$db_password = $pass;
$db_database = $db;
return $connexion = new PDO("mysql:host=$db_host;dbname=$db_database", $db_user, $db_password);
}
Hope someone can help me understand. Thank you in advance. Cheers. Marc