Skip to content

Create nested dropdown array from database table

Problem:


It is possible to load array from the database table directly when creating nested dropdown as seen in https://phpgrid.com/example/nested-dropdown/

Solution:


No, unfortunately, it's best to use array. However, you can programmatically form the array from database, and json encode the array.

ex.

while($row = mysql_fetch_assoc($result)){
    $json[] = $row;
}

echo json_encode($json);


Feedback and Knowledge Base