probleme pour afficher un tableau
Posté : 06 août 2012, 19:58
Salut
jai un probleme avec mon code
kan j'execute il affiche une erreur qui est:
Fatal error: Call to a member function fetch() on a non-object in C:\wampfinal\www\test\Admin\commentairesGestion.php on line 42
ligne 42 ce: <?php while($donnees=$resultat->fetch())
jai un probleme avec mon code
kan j'execute il affiche une erreur qui est:
Fatal error: Call to a member function fetch() on a non-object in C:\wampfinal\www\test\Admin\commentairesGestion.php on line 42
ligne 42 ce: <?php while($donnees=$resultat->fetch())
<?php session_start();if(!isset($_SESSION['login']))
//header('Location:../index.php'); require_once('../Connections/maconnexion.php');
if(isset($_GET['supp']))
{
$requete2='DELETE FROM commmentaires WHERE id='.$_GET['id'];
$pdo->query($requete2);
}
//----Requete liste
$req= "SELECT * FROM Commmentaires ";
//$req->execute();
$resultat=$req;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" />
<title>page du gestion des commenatires</title>
</head>
<body>
<h1>GESTION DES COMMENTAIRE</h1>
<br/>
<table width="600" border="1" cellspacing="0" cellpadding="5">
<tr>
<td>id commentaire</td>
<td>id du blog</td>
<td>auteur</td>
<td>texte du commentaire</td>
<td>date du commentaire</td>
<td>supp</td>
</tr>
<?php while($donnees=$resultat->fetch()) {?>
<tr>
<td><?php echo $donnees['id']; ?></td>
<td><?php echo $donnees['id_billet']; ?></td>
<td><?php echo $donnees['auteur']; ?></td>
<td><?php echo $donnees['commentaire']; ?></td>
<td><?php echo $donnees['date_commentaire']; ?></td>
<td><a href= "commentairesGestion.php?id=<?php echo $donnees['id'];?>&supp=ok">supp</a></td>
</tr>
<?php } ?>
</table>
</body>
</html>
Merci de m'avoir aider