Re: assignment of data into a 2 dimensional array

From: Date: Mon, 03 May 2004 19:44:56 +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-185239@lists.php.net to get a copy of this message
On Mon, 3 May 2004, Torsten Roehr wrote: > Output the array this way: > > foreach ($array as $key => $value) { > > echo 'date: ' . $key . ', count: ' . count(array_unique($value)); > } > > > > > 2) Since the person can enter a range of dates, as an example 4-20-2004 > > through 05-03-2004 in the html form, how can I print the date and the > > corresponding cardnum's after I've removed the unique patron numbers? It > > would need to go onto the next day after loop or printing second dimension > > get to a a dimension that is not set. > > Does this mean you would like to recognize EVERY day in the specified time > range even if they are not part of the array? > > Regards, Torsten > > > > > I was thinking of a foreach inside of a while loop, but I just don't know > > enough about arrays to figure out the code. > > i have this as my code after I run the sql statement: while ($row = mssql_fetch_array($query)) { $array[$row[$date]][] = $row[cardnum]; } foreach ( $array as $key => $value) { echo 'date: '. $key .', count: ' . count($array_unique($value)); } and I get the error on the foreach() line: Warning: Inavlid argument supplied for foreach() in c:\htdocs\patroncists.php on line 39. and line 39 is the foreach() line. Any suggestions on why I get that error? thanks

« previous php.general (#185239) next »