RE: [PHP] array headaches

2001-02-22 Thread PHPBeginner.com
TED] www.phpbeginner.com -Original Message- From: Matt Williams [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 21, 2001 11:57 PM To: [EMAIL PROTECTED]; PHP_UK@egroups. com Subject: [PHP] array headaches Hi could anybody please help me get my head around the following. I get some

RE: [PHP] array headaches

2001-02-22 Thread Matt Williams
> Why do you need to put the values in an array, then read through the > array to print the values? Why not just print each record as you get it > from the DB? The array is formed before the page is called. This is then passed to the page which prints it out. M@ > On Thu, 22 Feb 2001 02:11, M

Re: [PHP] array headaches

2001-02-21 Thread David Robley
On Thu, 22 Feb 2001 02:11, Matt Williams wrote: > I have done it this way... > > $menu = array(); > $count = $db->num_rows(); > for($i = 0; $db->next_record(); $i++) > { > $menu[$i]["name"] = $db->f("name"); > $menu[$i]["url"] = $db->f("topic_id"

RE: [PHP] array headaches

2001-02-21 Thread Matt Williams
n"; } is there any better way of doing this?? thanks M@ > -Original Message- > From: Pavel Kalian [mailto:[EMAIL PROTECTED]] > Sent: 21 February 2001 15:00 > To: Matt Williams; [EMAIL PROTECTED]; PHP_UK@egroups. com > Subject: Re: [PHP] array

Re: [PHP] array headaches

2001-02-21 Thread Jason Stechschulte
> while($db->next_record()) > { > $menu[]["name"] = $db->f("name"); > $menu[]["url"] = $db->f("topic_id"); > } Why not use a for loop instead? for($i = 0; $db->next_record(); $i++) { $menu[$i]["name"] = $db->f("name"); $menu[$i]["url"] = $db->f("topic_id"); } Then you can access them thro

RE: [PHP] array headaches

2001-02-21 Thread Matt Williams
ll > > Pavel > > - Original Message - > From: "Matt Williams" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; "PHP_UK@egroups. com" > <[EMAIL PROTECTED]> > Sent: Wednesday, February 21, 2001 3:56 PM > Subject: [PHP] array he

Re: [PHP] array headaches

2001-02-21 Thread Pavel Kalian
el - Original Message - From: "Matt Williams" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "PHP_UK@egroups. com" <[EMAIL PROTECTED]> Sent: Wednesday, February 21, 2001 3:56 PM Subject: [PHP] array headaches > Hi > > could anybody please help me get

[PHP] array headaches

2001-02-21 Thread Matt Williams
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??