Re: array headaches
| From: | Pavel Kalian | Date: | Wed, 21 Feb 2001 15:00:24 +0000 |
| Subject: | Re: array headaches | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40958@lists.php.net to get a copy of this message | ||
a) $menu[] = array("name" => $db->f("name"), "url" =>
$db->f("topic_id"));
b) echo $menu[0]["name"]; //for example - depends on what you want to do
BTW have a look into the manual, the array stuff is described pretty well
Pavel
----- Original Message -----
From: "Matt Williams" <matt@yewlands.com>
To: <php-general@lists.php.net>; "PHP_UK@egroups. com" <PHP_UK@egroups.com>
Sent: Wednesday, February 21, 2001 3:56 PM
Subject: [PHP] array headaches
> Hi
>
> could anybody please help me get my head around the following.
>
> I get some url information from the database (title, url)
> I am trying to then put this into an array so I can pass it to the page to
> display a menu.
> so
> a) how do I get the data into the array. would this be the way to do it??
>
> $menu = array();
> while($db->next_record())
> {
> $menu[]["name"] = $db->f("name");
> $menu[]["url"] = $db->f("topic_id");
> }
> which leads me onto
> b) how do I get the data back out. I can't test to see if the above works
as
> I can't get at the data
>
> TIA
>
> M@
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>