php - How to generate a dynamic array -


i have generate dynamic menu fetch data database , store result in dynamic array. how achieve in php?

arrays dynamic default in php, add more items it. shown in example (assuming database mysql):

$result = mysql_query(...); $menu_array = array(); $i = 0; while($row = mysql_fetch_array($result)) {     $menu_array[$i] = $row['menu'];     $i++; } 

now $menu_array contains menu elements fetched database.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -