Problème d'affichage

safa - 10 déc. 2013 à 13:20
jordane45 Messages postés 38136 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 16 avril 2024 - 10 déc. 2013 à 13:24
Bonjour,
svp aidez moi à corriger ce probleme [Fatal error: Cannot use object of type client as array in C:\wamp\www\safa\projet marwa\clientm\afficltm.php on line 16]
<table width="590" height="151" border="1">
<tr>
<td>code</td>
<td>nom</td>
<td>prenom</td>
<td>adresse</td>
<td>telephone</td>
</tr>
<?php
include("traitafficltm.php");
$cltm=new client;
$liste=$cltm->listecltm();
foreach($liste as $cltm);
?>
<tr>
<td><?php echo $cltm["code"];?></td>
<td><?php echo $cltm["nom"];?></td>
<td><?php echo $cltm["prenom"];?></td>
<td><?php echo $cltm["adresse"];?></td>
<td><?php echo $cltm["telephone"];?></td>
</tr>
<?php
?>
</table

1 réponse

jordane45 Messages postés 38136 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 16 avril 2024 344
10 déc. 2013 à 13:24
Bonjour,

Déjà, merci de penser à utiliser la coloration syntaxique lorsque tu postes du code ( explications disponibles : ICI

Ensuite, je pense que ton souci se situe dans cette partie du code :
$liste=$cltm->listecltm(); 
foreach($liste as $cltm); 



Change le nom de ta varible dans ton foreach ( $cltm est déjà l'objet instencié dans la ligne précédente... et ne peut pas être, en plus, un tableau => ce qui est dit dans le message d'erreur !! )



0
Rejoignez-nous