Hello,

Im having a hard time loading a table into a array. I need cat_id & category into $categoryArray[] to later use to display on the page.
any help you can give would be greatly appreciated

my table(tbl_category)
Cat_id Category
1 Accounting
2 marketing
3 Finance
.. ...

try
{ $query = $db->prepare('SELECT tbl_category.category, tbl_category.cat_id FROM tbl_category ORDER BY tbl_category.category');
$query->execute();
while($row=$query->fetch(PDO::FETCH_ASSOC))
{ $categoryArray[] = $row['category']; }

//foreach($categoryArray as $key1 => $value1)
//{ foreach($value1 as $key2 => $value2)
{echo $value1. " ". $key2.'<br />';}
//}
}
catch(PDOException $e)
{ echo 'ERROR: ' . $e->getMessage(); }