Problemme PHP/MSQL
Vlaoff
-
jona303 Messages postés 390 Statut Membre -
jona303 Messages postés 390 Statut Membre -
Bonjour,
voila j'ai fais le script suivant (grace à sdz )
et il ne marche pas ^^
Ca m'affiche l'erreur suivante : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Nouveau dossier\test2.php on line 64
la ligne 64 correspond à
merci de m'aider ça fais 20 minutes que je cherche l'erreur et je trouve pas ^^
voila j'ai fais le script suivant (grace à sdz )
et il ne marche pas ^^
<?php
if (isset ($_POST['email']) AND isset($_POST['nom']) AND isset($_POST['prenom']))
{
if ($_POST['email'] != "" AND $_POST['nom'] != "" AND $_POST['prenom'] != "")
{
mysql_connect("localhost", "root");
mysql_select_db("coursphp");
$email = mysql_real_escape_string(htmlspecialchars($_POST['email']));
$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));
$prenom = mysql_real_escape_string(htmlspecialchars($_POST['prenom']));
mysql_query("INSERT INTO newsletter VALUES('', '', '$email', '$nom', '$prenom')");
mysql_close();
}
}
?>
<form action="test2.php" method="post" >
<p> Nom : <input type="text" name="nom"><br/>
Prenom : <input type="text" name="email"><br/>
</p>
<input type="submit" value="Envoyer" />
</form>
<?php
mysql_connect("localhost", "root");
mysql_select_db("coursphp");
if (isset ($_POST['email']) AND isset($_POST['nom']) AND isset($_POST['prenom']))
{
$email = addslashes($_POST['email']);
$nom = addslashes($_POST['nom']);
$prenom = addslashes($_POST['prenom']);
if ($_POST['id_news'] == 0)
{
mysql_query("INSERT INTO news VALUES('', '', '" . $email . "', '" . $nom . "', '" . $prenom . "')");
}
else
{
$_POST['id_news'] = addslashes($_POST['id_news']);
mysql_query("UPDATE news SET email='" . $email . "', nom='" . $nom . "', prenom='" . $prenom . "', WHERE id='" . $_POST['id_news'] . "'");
}
}
if (isset($_GET['supprimer_news']))
{
$_GET['supprimer_news'] = addslashes($_GET['supprimer_news']);
mysql_query('DELETE FROM newsletter WHERE id=\'' . $_GET['supprimer_news'] . '\'');
}
?>
<table><tr>
<th>Modifier</th>
<th>Supprimer</th>
<th>Nom</th>
<th>Email</th>
</tr>
<?php
$reponse = mysql_query('SELECT * FROM newsletter ORDER BY id DESC');
while ($donnes = mysql_fetch_array($reponse));
{
?>
<tr>
<td><?php echo '<a href="rediger_news.php?modifier_news=' . $donnes['id'] . '">'; ?>Modifier</a></td>
<td><?php echo '<a href="liste_news.php?supprimer_news=' . $donnes['id'] . '">'; ?>Supprimer</a></td>
<td><?php echo stripslashes($donnes['nom']); ?></td>
<td><?php echo stripslashes($donnes['email']); ?></td>
</tr>
<?php
}
mysql_close();
?>
Ca m'affiche l'erreur suivante : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Nouveau dossier\test2.php on line 64
la ligne 64 correspond à
while ($donnes = mysql_fetch_array($reponse));
merci de m'aider ça fais 20 minutes que je cherche l'erreur et je trouve pas ^^
A voir également:
- Problemme PHP/MSQL
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Retour a la ligne php - Forum Webmastering
- Alert php - Forum PHP
- Retour a la ligne php ✓ - Forum PHP