From my query, I’m returning two columns from my database being PK_MenuItemCategoryId & CategoryTitle, so far so good
following on from that, doing a print_r, I get the following associative array as a result:
`Array
(
[PK_MenuItemCategoryId] => 1
[CategoryTitle] => Traditional Favourites
)
Array
(
[PK_MenuItemCategoryId] => 2
[CategoryTitle] => Starters
)
Array
(
[PK_MenuItemCategoryId] => 3
[CategoryTitle] => Mains
)
Even that by my understanding is correct but question1 is should the keys be the same?
Question 2: The result I want is the value from PK_MenuItemCategoryId to be key and value from CategoryTitle to be value
in other words
1 => Traditional Favourites
2 => Starters
3 => Mains
Being a newbie to PHP, I’m struggling to find a solution, I get the feeling it would be along the lines of assigning the associative array to an array but I’m not sure as to assigning the keys and values
any ideas/ solutions would be greatly appreciated