Bonjour
me renvoie l'erreur
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
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <?php session_start(); include_once"PHP_Inc/base.php"; include_once'CLASS/date.class.php'; include_once'CLASS/reu.class.php'; include_once'CLASS/participants.class.php'; include_once'PHP_Inc/donnees.php'; include_once'PHP_Inc/ident.php'; $affichreu->execute(); $date = new ladate(); $reunion= new reunion(); $particip=new participants(); $idreu=$_GET['dt']; $docreu->execute(array($idreu)); $listereu = $docreu->fetch(); $date->hydrate($listereu); $reunion->hydrate($listereu); $tabpartreu=explode(",", $listereu['presents']); foreach ($tabpartreu as $key => $value){ $affichparticipant->execute(array($value)); $participant1=$affichparticipant->fetch(); $particip->hydrate($participant1); print_r($participant1); } ?>
Uncaught TypeError: Argument 1 passed to participants::hydrate() must be of the type array, boolean given
alors que mon print_r de test (ligne 27)me renvoie bien un array
je veux hydrater cette classe
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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 <?php // ********************************************************************* // **** CLASS participants // ********************************************************************* class participants{ // definitions des variables nécessaires private $_id; private $_nom; private $_prenom; private $_mail; private $_mail2; private $_remarque; private $_tel; private $_tel2; private $_ste; private $_fonction; // liste des getters renvoie la valeur à l'objet public function id(){ return $this-> _id;} public function nom(){ return $this-> _nom;} public function prenom(){ return $this-> _prenom;} public function mail(){ return $this-> _mail;} public function mail2(){ return $this-> _mail2;} public function remarque(){ return $this-> _remarque;} public function tel(){ return $this-> _tel;} public function tel2(){ return $this-> _tel2;} public function societe(){ return $this-> _ste;} public function fonction(){ return $this-> _fonction;} // hydratation affectation aux setters des valeurs de la base de données public function hydrate(array $donnees) { foreach ($donnees as $key => $value)// parcours du tableau des données { $method = 'set'.ucfirst($key);// la clef = nom du setter (majuscule pour respecter le nommage) if (method_exists($this, $method)) { // On appelle le setter. $this->$method($value); } } } // setter remplissent, modifient les variables public function setId_part($id) { if (is_numeric($id)){ $this->_id=$id; } } public function setNom($nom) { if (is_string($nom)){ $this->_nom=$nom; } } public function setPrenom($prenom) { if (is_string($prenom)){ $this->_prenom=$prenom; } } public function setMail($mail){ if (is_string($mail)){ $this->_mail=$mail; } } public function setMail2($mail2) { if (is_string($mail2)){ $this->_mail2=$mail2; } } public function setRemarqmail2($remarque) { if (is_string($remarque)){ $this->_remarque=$remarque; } } public function setTel($tel) { if (is_string($tel)){ $this->_tel=$tel; } } public function setTel2($tel2) { if (is_string($tel2)){ $this->_tel2=$tel2; } } public function setSociete($ste) { if (is_string($ste)){ $this->_ste=$ste; } } public function setFonction($ftn) { if (is_string($ftn)){ $this->_fonction=$ftn; } } }
Partager