Probleme fonction fetch () ;
barilona
Messages postés
3
Statut
Membre
-
jeremy.s Messages postés 1248 Statut Membre -
jeremy.s Messages postés 1248 Statut Membre -
Bonjour,
j'ai un problème au niveau de la fonction fetch () quelqu'un m'aider svp et merci
l'erreur :Fatal error: Call to a member function fetch() on a non-object in C:\wamp\www\yakbir\bilet.php on line 21
j'ai un problème au niveau de la fonction fetch () quelqu'un m'aider svp et merci
l'erreur :Fatal error: Call to a member function fetch() on a non-object in C:\wamp\www\yakbir\bilet.php on line 21
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="meh.css"
<meta charset="utf-8" />
<title>mon blog</title>
</head>
<body>
<h1>Mon super blog !</h1>
<p>Derniers billets du blog :</p>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=teste;charset=utf8','root','',array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
}
catch(Exeption $e) {
die ('Erreur'. $e->getMessage()) ;
}
$req =$bdd->query('SELECT id,titre,contenu,FORMAT_DATE(date-creation,\' %d/%m/%y %Hh%imin%ss \') AS date-creation-fr FROM billets ORDER BY date-creation DESC LIMIT 0,5');
while ($donnees =$req->fetch())
{
?>
<div class="news">
<h3>
<?php echo htmlspecialchars($donnees['titre']); ?>
<em>le <?php echo $donnees['date_creation_fr']; ?></em>
</h3>
<p>
<?php
// On affiche le contenu du billet
echo nl2br(htmlspecialchars($donnees['contenu']));
?>
<br />
<em><a href="commentaires.php?billet=<?php echo $donnees['id']; ?>">Commentaires</a></em>
</p>
</div>
<?php
} // Fin de la boucle des billets
$req->closeCursor();
?>
</body>
</html>
A voir également:
- Probleme fonction fetch () ;
- Fonction si et - Guide
- Fonction miroir - Guide
- Fonction moyenne excel - Guide
- Fonction remplacer sur word - Guide
- Fonction somme excel - Guide