Bonsoir,
J'ai un petit problème au niveau de ma chatbox, en effet, le nom d'utilisateur et l'avatar disparaisse quand le js est actif et je vois pas où est le problème car ça fonctionne genre le chat est bien dynamique il n'y a pas besoin de rafraîchir la page pour voir le message suivant.
PAGE chargement_message.php :
Code html : 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 <script type="text/javascript"> setInterval('chargement_message()', 500); function chargement_message(){ $('#message').load('chargement_message.php'); } </script> <div id="message"> <div style="border: 1px solid red; background-color: white; width: 50%; height: 50%;margin-left: 25%; overflow: scroll; overflow-x: hidden;"> <?php $tous_les_msg = $bdd -> query('SELECT * FROM chat ORDER BY id DESC LIMIT 0, 15'); while($msg = $tous_les_msg -> fetch()) { ?> <div align="left"> <p class="police1"><?php if(!empty($info_utilisateur['avatar'])) {?><a href="profil_principal.php?pseudo=<?php echo $msg['pseudo'] ?>&avatar=<?php echo $msg['avatar'] ?>"><img style="border-radius: 25%;" src="avatars/<?php echo $msg['avatar']; ?>" width="50" height="50"></a> <span style="font-family: arial; text-decoration: underline;"><a href="profil_principal.php?pseudo=<?php echo $msg['pseudo'] ?>&avatar=<?php echo $msg['avatar'] ?>"><?php echo $msg['pseudo']; }?></a></span> <?php ; ?> :<br><br> <span style="margin-left: 5.5%;"><?php echo $msg['msg']; ?></span></p> </div> <?php } ?> </div> </div>
Code html : 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 <div id="message"> <div style="border: 1px solid red; background-color: white; width: 50%; height: 50%;margin-left: 25%; overflow: scroll; overflow-x: hidden;"> <?php $bdd = new PDO("bddquimarchevousinquiétezpas;)"); $tous_les_msg = $bdd -> query('SELECT * FROM chat ORDER BY id DESC LIMIT 0, 15'); while($msg = $tous_les_msg -> fetch()) { ?> <div align="left"> <p class="police1"><?php if(!empty($info_utilisateur['avatar'])) {?><a href="profil_principal.php?pseudo=<?php echo $msg['pseudo'] ?>&avatar=<?php echo $msg['avatar'] ?>"><img style="border-radius: 25%;" src="avatars/<?php echo $msg['avatar']; ?>" width="50" height="50"></a> <span style="font-family: arial; text-decoration: underline;"><a href="profil_principal.php?pseudo=<?php echo $msg['pseudo'] ?>&avatar=<?php echo $msg['avatar'] ?>"><?php echo $msg['pseudo']; }?></a></span> <?php ; ?> :<br><br> <span style="margin-left: 5.5%;"><?php echo $msg['msg']; ?></span></p> </div> <?php } ?> </div> </div>
Partager