Citation :
<?
mysql_connect("localhost", "root", "" );
mysql_select_db("projet" );
$reponse = mysql_query ("SELECT * FROM chat ORDER BY id DESC LIMIT 0,10" );
if (isset($_POST["nom"]) AND isset($_POST["message"]))
{
$name = htmlentities ($_POST["nom"]);
$mess = htmlentities ($_POST["message"]);
mysql_query ("INSERT INTO chat VALUES(" ", $name, $mess)" );
}
while ($donnees = mysql_fetch_array($reponse))
{
?>
<html>
<head><title>chat</title></head>
<body>
<p>
pseudo :<form action="chat.php" method="post">
</p>
<p>
<input type="text" name="nom" />
</p>
</form>
<p>
ton message :<form action="chat.php" method="post">
</p>
<p>
<input type="text" name="message" /> <input type="submit" value="valider" />
</p>
</form>
<p>
<? echo $donnees["pseudo"]; ?>
:
<? echo $donnees["message"]; ?>
</p>
</body>
</html>
<?
}
mysql_close();
?>
|