I am a beginner with php and PDO and need help solving this error that I keep getting on this line of code $category_name [$category["category_id"]] = $category["category"]; I continue to get, Notice: Undefined index: category. Also Undefined index: category_id. I dont have a clue as to why, could someone provide me with the correct way to do this. Here is my code. This one slightly different because it used in a while statement.
// get the item category names
$category_name = Array();
$query = 'SELECT * FROM category_2';
$categories_list = $db->prepare($query);
$categories_list->execute();
while ($category = $categories_list->fetchAll())
{
$category_name [$category["category_id"]] = $category["category"];
}