Re bonjour le forum.
J'ai semble t'il un problème d'encodage.
J'ai une page php, et quand j'écris :
J'ai "tété" en affichage.
Code : Sélectionner tout - Visualiser dans une fenêtre à part <p>tété</p>
Mais quand j'essaye d'afficher un texte récupéré de ma base de donnée avec un accent, j'ai "t�t�"
J'ai essayé de fouiller un peu pour trouver le problème et apparemment il faudrait déclaré ma valeur en UTF8 sur ma variable ( mais je suis certainement or sujet )
Voici mon fichier php :
Mon fichier connexion.php est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"> <head> <?php include('connexion.php') ?> <title> </title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/default.css" media="screen" /> </head> <body> <h1><?php echo $metier; ?></h1> </body> </html>
Dans ma table mysql, le mot est "tété" en utf8_general_ci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <?php $hostname = "localhost"; $user = "root"; $password = ""; $base = "test1"; $conn = mysqli_connect($hostname, $user, $password) or exit('connexion impossible'); mysqli_select_db($conn,$base); $sql2 = "SELECT metier FROM jeux_video"; $resu2 = mysqli_query ($conn,$sql2); $infos2 = mysqli_fetch_array ($resu2); $metier = $infos2['metier']; ?>
Donc je comprend pas pourquoi sa bloque mais doit y avoir un truc :-)
Partager