Hello all :)
Well, im trying to display a list of categories from values fetched from my database. I have a class called CategoryList which has the function initialise as below:
GetCategory actually uses PDOStatement::FetchAll
public function init()
{
$this->mCategory = Catalog::GetCategory();
print_r($this->mCategory);
}
Then i have my index.php where I need to display the list of categories
$obj = new CategoryList();
if (method_exists($obj, 'init'))
{
$obj->init();
}
I get the following result
Array ( [0] => Array ( [category_id] => 1 [name] => Doors and Windows ) [1] => Array ( [category_id] => 2 [name] => Electrical ) )
What i want is something like:
Doors and Windows
Electrical
I have tried
for($i = 0 ; $i < 10; $i++ )
$obj->mCategory[$i].name ;
But I get ERRNO: 8
TEXT: Use of undefined constant name - assumed 'name'
Can anyone help me with this please?