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
|
class Personnes
{
var $Items;
function Personnes()
{
$this->Reset();
}
function LiretoutLeMonde()
{
$this->Reset();
$Obj = NULL;
$sql = "SELECT toto, tata , titi FROM personnes";
$query = mysql_query($sql);
while($res = mysql_fetch_assoc($query) )
{
$Obj = new Personne();
$Obj->Construit($res);
$this->Items[] = $Obj;
}
}
function Reset()
{
$this->Items = array();
}
}
class Personne
{
var $nom;
var $prenom;
var $annee;
function Personne( )
{
$this->nom = NULL;
$this->prenom = NULL;
$this->annnee = NULL;
}
function Lire/* ou Populate c'est au choix*/( $id )
{
$sql = "select toto, tata , titi from personne where id_personne = ".$id;
$res = mysql_query($sql);
$data = mysql_fetch_assoc($res);
$this->Construit( $data );
}
function Construit( $TabMatiere )
{
$this->nom = $TabMatiere ['nom_personne'];
$this->prenom= $TabMatiere ['prenom_personne'];
$this->annee= $TabMatiere ['annee_personne'];
}
} |