Eric, If I understand your request, it seems as if you are wondering what would happen if the array got too large. If you want to do some kind of processing with the array, instead of loading it into an array, do the processing in the while loop.
$query = "select email, fullname from tablename where updateannounce = 1"; $result = mysql_query($query); while ($output = mysql_fetch_array($result)) { //do whatever you want here, i.e. echo $result['name'] or $result['address'] } -Dash Newlan's Truism: An "acceptable" level of unemployment means that the government economist to whom it is acceptable still has a job. On Mon, 20 Jan 2003, Eric wrote: > Dear sir, > I'am Eric > I have the same question about this. > But what if does will this the final $to[] array will contains all of > address and name data. > but the address bar should not be hold if a large number of address > presents. > Is that have any suggestions?? > Thanks yours > > tarn@hk > > ----- Original Message ----- > From: "Dash McElroy" <[EMAIL PROTECTED]> > To: "H Marc Bower" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Sunday, January 19, 2003 11:33 AM > Subject: Re: [PHP-WIN] arrays and nested arrays and loops and databases... > > > > If I understand correctly, you want to have an array containing an array > > with people's email address and name from your db like this: > > > > $to[0]['address'] = [EMAIL PROTECTED] > > $to[0]['name'] = Bob Smith > > $to[1]['address'] = [EMAIL PROTECTED] > > $to[1]['name'] = John Jones > > > > (the above is obviously not valid PHP...) > > > > I would do something like this: > > > > $to = array(); > > $query = "select email, fullname from tablename where updateannounce = 1"; > > $result = mysql_query($query); > > while ($output = mysql_fetch_array($result)) { > > $to[] = array('address' => $output['address'], > > 'name' => $output['name']); > > } > > > > assuming, of course, that your database column names are 'address' and > > 'name'. > > > > This should work, but I may have borked something up on the name based > > arrays. > > > > -Dash > > > > "The pyramid is opening!" > > "Which one?" > > "The one with the ever-widening hole in it!" > > -- Firesign Theater, "How Can You Be In Two Places At > > Once When You're Not Anywhere At All" > > > > On Sat, 18 Jan 2003, H Marc Bower wrote: > > > > > Well... I can usually puzzle myself through these things, but I figured > > > it's time to ask the list. :) It may be a simple thing that I'm > missing, > > > but here's what I have. > > > > > > The structure that I'm trying to modify is as follows: > > > > > > $to = array( > > > array( > > > 'address'=>'[EMAIL PROTECTED]', > > > 'name'=>'Bob Smith' > > > ), > > > array( > > > 'address'=>'[EMAIL PROTECTED]', > > > 'name'=>'John Jones' > > > ) > > > ); > > > > > > That said, I have a database of names and email addresses which I want > to > > > insert into this structure, but in a loop since I don't want to have an > > > array() section for each one, not knowing how many are going to be in > the > > > list at the time this script is run. I want to loop the 'sub' array() > > > statements so that I can build up the main array(). I use mysql as > follows: > > > > > > $query = "select email, fullname from tablename where updateannounce = > 1"; > > > $result = mysql_query($query); > > > while ($output = mysql_fetch_array($result)) > > > { > > > //This is where I want the loop of arrays to appear, so I can > > > dynamically insert the email and fullname fields into the obvious spots > > > } > > > > > > > > > I need to figure out how to do this, essentially: > > > > > > $to = array(<loop to fill other array() statements>); > > > > > > I don't know how to get that loop to work inside the overall array() > > > statement, though... any assistance would be greatly appreciated. > > > > > > Thank you, > > > > > > Marc > > > > > > > > > > > > -- > > > PHP Windows Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php