ah..yes, thanks, works like a charm. -----Original Message----- From: Torsten Roehr [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 8:49 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: dynamically build array from db
"Edward Peloke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a class which builds a set of tabs...the class expects an array in > this form > > array("Site Info"=>"siteinfo.php","Contact Us"=>"contactus.php")..where Site > Info is a link to siteinfo.php. > > The build tabs method of the class then loops through the array outputing a > set of tabbed links on the page. > > The problem is I am having trouble generating this array from a database. I > need to pull from my query: > > $sql->query("select title, page from links"); > while ($sql->nextRecord()){ > > file://build the array > > } > > I have tried arraypush but can only get it to work with a standard > array...how can I do this? $array = array(); while ($sql->nextRecord()){ // figure out how to get $title and $page from your record set (do didn't say which DB layer you are using) $array[$title] = $page; } Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php