salut à tous
j’ai un probléme dans l’affichage de données d’un utilisateur de mon site web j’ai beaucoup essayé mais ça marche pas voila le code que j’ai essayé dernièrement
<?php
session_start();
if(!empty($_SESSION['_mail']))
echo ' <a href="logout.php">Deconnexion</a>';
?>
<link href="style1.css" rel="stylesheet" type="text/css" />
<?php
//include_once ("header.php");
//connexion PDO
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$host = 'localhost';
$login = 'root'; // exemple
$pass = ''; // exemple
$db = 'siteducommerce'; // exemple
try {
$bdd = new PDO("mysql:host=$host;dbname=$db", $login, $pass, $options);
// Suite du code utilisant ici et là des requêtes
}
catch(PDOException $e) {
trigger_error(sprintf('Erreur MySQL %d : %s', $e->getCode(), $e->errorInfo[2]));
}
$id=#SESSION{idCommercant}
//$mail=$_SESSION['_mail'];
$reponse = $bdd->prepare("SELECT * FROM produit, produit_commerce, commerce, commercant
where produit_commerce.idmagasin=commerce.idMagasin
and produit.idProduit=produit_commerce.idproduit
and commerce.idCommercant= commercant.idCommercant
and commercant.idCommercant=:id ;");
$reponse->execute(array('id'=>$id)) or die(print_r($reponse->errorInfo()));
while ($donnees = $reponse->fetch())
{
?>
<p>
<strong>Produit</strong> : <?php echo $donnees['nomproduit']; ?><br />
type de produit : <?php echo $donnees['typeProduit']; ?>
categorie: <?php echo $donnees['categorie']; ?><br />
marque: <?php echo $donnees['marque']; ?>
reference: <?php echo $donnees['reference']; ?> <br />
description :<?php echo $donnees['description']; ?> <br />
taille : <?php echo $donnees['taille']; ?>
auteur : <?php echo $donnees['auteur']; ?>
prix : <?php echo $donnees['prix']; ?> <br />
en stock :<?php echo $donnees['enStock']; ?>
taillesDispo: <?php echo $donnees['taillesDispo']; ?> <br />
couleursDispo <?php echo $donnees['couleursDispo']; ?>
</p>
<?php
}
$reponse->closeCursor();
?>
<?php
//include_once ("footer.php");
?>
il m’affiche l’erreur suivante Catchable fatal error : Object of class PDOStatement could not be converted to string in D :\wamp\www\it_technology\Affichage\essai.php on line 44
quelqu’un peut m’aider svp
merci d’avance