Re: assignment of data into a 2 dimensional array

From: Date: Mon, 03 May 2004 19:27:36 +0000
Subject: Re: assignment of data into a 2 dimensional array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185237@lists.php.net to get a copy of this message
On Mon, 3 May 2004, John W. Holmes wrote: > while($row = mssql_fetch_array($result)) > { > $array[$row['date']][] = $row['cardnum']; > } > > ?? > > That should produce something like > > Array ( '04-20-2004' => array(2379,2380,296,314,2396,2395), '04-21-2004' > => > array(2398,1403,1736,1828,1203)) > > count($array['04-21-2004']) will tell you how many "cardnum"s are assigned > to that date. > > foreach($array['04-21-2004'] as $cardnum) > { echo $cardnum; } > > will allow you to loop through each date and print the cardnums associated > with it... > > Post back if that's not what you're after. > > ---John Holmes... > > I goofed on the 2) f my previous email. I meant to say I need to return the date and the count of the discrete cardnum's with the corresponding date, not the cardnum's for each date. sorry about that

« previous php.general (#185237) next »