[PHP] Re: Multidimensional arrays

2003-07-18 Thread John Kaspar
$sql = "select id, name from customer"; $rs = mysql_query($sql) or die("sql=$sql => ".mysql_error()); while ($row = mysql_fetch_assoc($rs)) { $custarray[] = $row; } /* $row is an array with the elements 'id' and 'name' $custarray becomes a multi-array indexed starting a 0 e.g. $custarray[0]

[PHP] Re: Multidimensional arrays (more and more...)

2002-11-30 Thread Paul Chvostek
On Thu, Nov 28, 2002 at 10:19:38AM -0800, Mako Shark wrote: ... > My problem is I need to loop through these. So I can't > just assume that the count is count($issue[]) divided > by 8, because that won't work in a for loop. I suppose > I could just iterate through my for loop in jumps of > 8, but

[PHP] Re: Multidimensional arrays (more and more...)

2002-11-30 Thread Paul Chvostek
Well, counting is easy... count($issue) will be correct. If you want to count things that match only specific elements, use things like: $c=0; foreach($issue as $what) if ( $year==2003 && $month>=5 ) $c++; As I said in the previous email, to sort by array elements, you'd need to

RE: [PHP] Re: Multidimensional arrays (more and more...)

2002-11-29 Thread Ford, Mike [LSS]
> -Original Message- > From: Mako Shark [mailto:[EMAIL PROTECTED]] > Sent: 28 November 2002 18:20 > > A little more info on my count()ing. > I have $issue[0]["number"] to $issue[x]["number"] just > like any other multidimensional array (we'll call them > m-arrays for simplicity). > > If I

[PHP] Re: Multidimensional arrays (more and more...)

2002-11-28 Thread Mako Shark
Thanks to Paul and Marek for some ksort() advice. I'll try that out as soon as I can count() these buggers. A little more info on my count()ing. I have $issue[0]["number"] to $issue[x]["number"] just like any other multidimensional array (we'll call them m-arrays for simplicity). If I try to coun