Re: 2D arrays

From: Date: Fri, 08 Dec 2000 18:30:47 +0000
Subject: Re: 2D arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29388@lists.php.net to get a copy of this message
On Fri, 8 Dec 2000, Thomas Holton wrote: > Hello, > I cannot get any data into my 2D array. The documentation suggests > declaring 2d arrays in this fashion" > > <snip> > $dat = array(); > $dat = array_push($dat, array()); > $ff = array(); > while ($j < $numfields) { > $ff[$j] = mysql_field_name($r,$j); > print "ff=$ff[$j]<br>"; > $j++; > } > $i=0; $j=0; > while ($i < $numresults) { > while ($j < $numfields) { > $dat[$j][$i] = mysql_result($r,$i,$ff[$j]); > print "dat=$dat[$j][$i]<br>"; > $j++; > } > $i++; > } > reset($dat); // resets the pointer to be at the beginning > > $numfields and $numresults contain real numbers, AND the $ff 1D array is > also fine. > > This is the error message: > Warning: Cannot use a scalar value as an array in main_user.php on line 101 > dat=[0] > > Any help is appreciated! > thanks > -tom > Just out of curiosity, what is this code supposed to be doing? -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#29388) next »