I'm working with one project where i should be able to build easy to use classes for outputting menus.
class xxx_list_content {
var $name;
var $id;
var $producer;
var $performer;
var $items;
function xxx_list_content($cat,$typ,$pcs) {
global $c;
$c = 0;
$sql = new sql;
$query = "select name,cont_id from tbl_content";
$sql->exec($query);
while($row = $sql->row()) {
$this->items[$c]["name"] = $row["name"];
$this->items[$c]["id"] = $row["cont_id"];
$c++;
}
}
function xxx_fetch() {
global $c;
while($c > 0) {
$this->name = $this->items[$c]["name"];
$c--;
}
}
}
$test = new xxx_list_content(1,2,3);
while($test->xxx_fetch()) {
echo $test->name;
}
So what i want to do is a query to database, then be able to use xxx_fetch method to return objects each by each...
This example just doesn't work... I think i have problem with syntax ? Database queries and so one works but i'm not getting the xxx_fetch method to work...
--
Fatbastard