1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <div id="tchat">
<?php $base = mysql_connect ("localhost", "root", "");
mysql_select_db ("test2");
//Post
$query2 = "SELECT Post, Nom, Prenom, Date, post.ID FROM users, post WHERE post.ID_Users=users.ID ORDER BY Date DESC";
$result2 = mysql_query($query2);
while($row2 = mysql_fetch_row($result2)){
echo "<div id='post'>";
$Nom = $row2[1];
$Prenom = $row2[2];
$Date = $row2[3];
echo "<div id='nom'>$Prenom $Nom à écrit :</div>";
$post = $row2[0];
$ID = $row2[4];
echo "<div id='message'><p>$post</p></div>";
echo "<div id='date'>Posté le $Date</div>";
echo "<form method='post' action='commentaire.php'>";
echo "<input type='text' name='commentaire'>";
echo "<input type='text' name='ID' value='$ID'>";
echo "<input type='submit' value='Commenter'>";
echo "</form>";
//Commentaires
$query3 = "SELECT commentaire.Post, Nom, Prenom, commentaire.Date, commentaire.ID FROM commentaire, users, post WHERE post.ID_Users=users.ID AND commentaire.ID_post=$ID";
$result3 = mysql_query($query3);
while($row3 = mysql_fetch_row($result3)){
echo "<div id='post1'>";
$Nom1 = $row3[1];
$Prenom1 = $row3[2];
$Date1 = $row3[3];
echo "<div id='nom'>$Prenom1 $Nom1 à écrit :</div>";
$post1 = $row3[0];
$ID1 = $row3[4];
echo "<div id='message'><p>$post1</p></div>";
echo "<div id='date'>Posté le $Date1</div>";
echo "<form method='post' action='commentaire.php'>";
echo "<input type='text' name='commentaire'>";
echo "<input type='text' name='ID' value='$ID1'>";
echo "<input type='submit' value='Commenter'>";
echo "</form>";
echo "</div>";
}
echo "</div>";
}
mysql_close();
?> |
Partager