1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public function setListCategories()
{
$query = mysql_query("SELECT * FROM categories ORDER BY cat_nom ASC");
while ($row = mysql_fetch_array($query))
{
$cat_id = $row["cat_id"];
$cat_nom = $row["cat_nom"];
$cat_desc = $row["cat_description"];
// Construction : Tableau de tableau
$this->lstCat[$cat_id]["catId"] = $cat_id;
$this->lstCat[$cat_id]["catNom"] = $cat_nom;
$this->lstCat[$cat_id]["catDesc"] = $cat_desc;
// echo $gFc->lstCat[2]['idCat']; // Retourne l'id catégorie
}
# Libère la mémoire allouée
mysql_free_result($query);
} |