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
|
public function AfficherRoles() {
$nb = count($this->roles);
echo $nb;
for($i=0;$i!=$nb;$i++){
$t = $this->roles[$i];
echo $t;
echo "<p></p>";
}
}
private function setAttributes($p) {
$this->setLogin($p->login);
$this->setNomPrenom($p->nom, $p->prenom);
$this->setidPerson($p->idPerson);
$this->setRoles($p);
}
private function set_user_in_session() {
$_SESSION['user'] = $this;
}
// j'arrive à enregistrer dans $_SESSION tout les paramètres sauf le tableau de roles
private function setRoles($p) {
$this->roles = array();
$idP=$p->getidPerson();
$sql ="SELECT distinct id_role FROM personne_roles pr, personne p WHERE $idP=pr.idPerson";
$result = mysql_query($sql);
while($row = mysql_fetch_row($result)){
$this->roles[0] = $row[0];
$row->MoveNext();
$this->roles->MoveNext();
}
///////////
Dans un autre fichier je veux afficher ce tableau :
$o = $_SESSION['user'];
$o->AfficherRoles();
// ce qui affcihe : 0 donc le tableau est vide |
Partager