Mini chat probléme sql aide svp
Profil bloqué
-
Profil bloqué -
Profil bloqué -
Bonjour,
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Minichat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="minichat_post.php" method="post">
<p>
<label for="nom">Nom</label> : <input type="text" name="nom" id="nom" /><br />
<label for="message">Message</label> : <input type="text" name="message" id="message" /><br />
<input type="submit" value="Envoyer" />
</p>
</form>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
}
catch(Exception $e)
{
die('Erreur: ' . $e->getMessage());
}
$reponse = $bdd->query('SELECT nom, message FROM minichat ORDER BY ID DESC LIMIT 0, 10');
while ($donnees = $reponse->fetch())
{
echo '<p>' . $donnees['nom'] . $donnees['message'] . '</p>';
}
$reponse->closeCursor();
?>
</body>
</html>
et
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
}
catch(Exception $e)
{
die('Erreur: ' . $e->getMessage());
}
$req = $bdd->prepare('INSERT INTO minichat(nom, message) VALUES(:nom, :message)');
$req->execute(array(
'nom' => $_POST['nom'],
'message' => $_POST['message']
));
header('Location: minichat.php');
?>
svp aide pour sql je trouve pas comment fait et tout le temps dé éreu sa m énerve
merci pour vaus réponse
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Minichat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="minichat_post.php" method="post">
<p>
<label for="nom">Nom</label> : <input type="text" name="nom" id="nom" /><br />
<label for="message">Message</label> : <input type="text" name="message" id="message" /><br />
<input type="submit" value="Envoyer" />
</p>
</form>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
}
catch(Exception $e)
{
die('Erreur: ' . $e->getMessage());
}
$reponse = $bdd->query('SELECT nom, message FROM minichat ORDER BY ID DESC LIMIT 0, 10');
while ($donnees = $reponse->fetch())
{
echo '<p>' . $donnees['nom'] . $donnees['message'] . '</p>';
}
$reponse->closeCursor();
?>
</body>
</html>
et
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
}
catch(Exception $e)
{
die('Erreur: ' . $e->getMessage());
}
$req = $bdd->prepare('INSERT INTO minichat(nom, message) VALUES(:nom, :message)');
$req->execute(array(
'nom' => $_POST['nom'],
'message' => $_POST['message']
));
header('Location: minichat.php');
?>
svp aide pour sql je trouve pas comment fait et tout le temps dé éreu sa m énerve
merci pour vaus réponse
A voir également:
- Mini chat probléme sql aide svp
- Coco chat - Accueil - Réseaux sociaux
- Opera mini pc - Télécharger - Navigateurs
- Chat engine - Télécharger - Outils Internet
- Fermeture de Coco : les internautes à la recherche d'un remplaçant - Accueil - Réseaux sociaux
- Chat tubidy - Télécharger - Outils Internet