Salut !
Lorsque j'insère une ligne dans ma table depuis l'onglet "Insérer" de phpmyadmin, je n'ai aucun de soucis d'encodage et tout s'affiche correctement. Mais quand j'insère depuis une requête insert into, j'ai des é & d'autres trucs du genre. Comment je corrige ceci ?
Affichage des données :
Code php : 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
21
22
23 <?php $req = $pdo->prepare("SELECT * FROM notifications WHERE id_membre = :id ORDER BY date_envoi DESC"); $req->execute(array("id" => $_SESSION["id"])); while($resultat = $req->fetch()) { ?> <div class="minicadre"> <table> <tr> <td colspan="2"> <?php echo utf8_encode($resultat["titre"]); ?> </td> </tr> <tr> <td style="width: 33px; vertical-align: top" valign="top"><img src="../images/<?php echo $resultat['image']; ?>"></td> <td style="font-size: 10pt; vertical-align: top" valign="top"> <?php echo utf8_encode($resultat["description"]); ?><br /> <?php echo utf8_encode($resultat["details"]); ?></td> </tr> </table> </div> <?php } ?>
Requête d'insertion :
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 $req4 = $pdo->prepare("INSERT INTO notifications(id_membre, titre, description, details, image, statut, date_envoi) VALUES(:id_membre, :titre, :description, :details, :image, :statut, NOW())"); $req4->execute(array( "id_membre" => $resultat["id_posteur"], "titre" => "Ton mot a été publié !", "description" => utf8_encode("Le mot que tu as publié a été accepté."), "details" => utf8_encode("Tu as gagné 10 points de participation."), "image" => utf8_encode("ajout.png"), "statut" => utf8_encode("non_lu")));
Partager