i want to generate this array from mysql data base result set??

$nav = Array
(
    Array
    (
        'id' => 27,
        'name' => 'home',
        'link' => 'home.html',
        'parent' => 0
    ),
    Array
    (
        'id' => 30,
        'name' => 'about',
        'link' => 'about.html',
        'parent' => 27
    )
);

Recommended Answers

All 2 Replies

did you try?

 while($row = mysql_fetch_array($result)) {
 $thisArray[] = $row;

 }

Try this:

<?
     while($row = mysql_fetch_array($result)) 
     {
        $one['id'] = $row['id'];
        $one['name'] = $row['name'];
        $one['link'] = $row['link'];
        $one['parent'] = $row['parent'];
        $thisArray[] = $one;
     }
     echo '<pre>';
     print_r($thisArray);

?>
commented: exact array +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.