First I did this simple query from MySQL workbench :
UPDATE PRODUIT
SET statut = "Expedié"
WHERE num_ref like "14T500924001"
And it save exactly the same value for statut field. Then I put this query in my php file like this :
$bdd->query('UPDATE PRODUIT SET statut = "Expedié" WHERE num_ref like "14T500924001"');
The difference its for the field statut it doesn't take the "é" from "Expedié" ... how can I fix this ? It shows me this : "Expedié"
In my html->head, I put this : <meta charset="utf-8">
but didn't change a lot.
UPDATE1
How I get $bdd :
function ConnexionBDD(){
try{
$bdd = new PDO('mysql:host=127.0.0.1:3306;dbname=NumeroSerie', 'root');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (Exception $e){
die('Erreur : '.$e->getMessage());
}
catch (PDOException $pe)
{
die ("I cannot connect to the database." . $pe->getMessage());
}
return $bdd;
};
To set your database connection to use utf8 encoding, use
$bdd = new PDO('mysql:host=127.0.0.1:3306;dbname=NumeroSerie;charset=utf8', 'root');
In addition, you need to make sure that your php source file is also encoded in utf8.
Specifying the character encoding in your html with <meta charset="utf-8">
does not change the encoding of your database connection. The alternative to the solution above would be to tell the browser you are sending iso-8859-1 encoding with <meta charset="iso-8859-1">
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments