Bonjour à tous.
Je sais pas si c'est le bon endroit pour poster ça, je m'excuse d'avance si j'ai commis une erreur.
Voici mon problème :
J'ai une classe Bd.php qui contient toutes mes fonctions accédant directement à ma bdd, une classe ServiceBd.php accédant aux fonctions du fichier Bd.php, et mes fichiers accédant a ServiceBd.php.
J'ai actuellement une petite erreur, et je ne vois pas comment la résoudre :
Voici les codes en question :Fatal error: Uncaught exception 'AccesTableException' in C:\wamp\www\PROJET\objet\bd\Bd.php:123
Stack trace:
#0 C:\wamp\www\PROJET\objet\metier\ServiceBd.php(70): Bd->getListeChoix('E094034L')
#1 C:\wamp\www\PROJET\objet\profil.php(138): ServiceBd->getAllChoix('E094034L')
#2 {main} thrown in C:\wamp\www\PROJET\objet\bd\Bd.php on line 123
Dans Bd.php:
Dans ServiceBd.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public function getListeChoix($etu) <?php { $this->connexion(); $requete='SELECT id, idEcole from choix WHERE idEtu='.$etu.';'; try { $resultat=$this->connexion->query($requete); } catch (PDOException $e) { throw new AccesTableException(); } $this->deconnexion(); return $resultat; } ?>
Dans Profil.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?php function getAllChoix($etu) { $listeChoix=$this->bd->getListeChoix($etu); foreach($listeChoix as $row) { $choix = new Choix($row['id'],$row['idEcole'],$row['idEtu']); $tableau[] = $choix; } return $tableau; } ?>
En espérant que vous pourriez m'aider, je suis bien évidemment à votre disposition pour toutes informations supplémentaires.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 <?php $choix = $servBd->getAllChoix($id); //$servBd est un objet de type ServiceBd ?>
Partager