RE: [PHP] Re: dynamically build array from db

From: Date: Tue, 08 Jun 2004 13:42:11 +0000
Subject: RE: [PHP] Re: dynamically build array from db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187877@lists.php.net to get a copy of this message
ah..yes, thanks, works like a charm. -----Original Message----- From: Torsten Roehr [mailto:roehr@zilleon.com] Sent: Tuesday, June 08, 2004 8:49 AM To: php-general@lists.php.net Subject: [PHP] Re: dynamically build array from db "Edward Peloke" <epeloke@echoman.com> wrote in message news:NKEFLLFBJFIKEGAGKPCAIEICDEAA.epeloke@echoman.com... > 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

« previous php.general (#187877) next »