Re: Help with array

From: Date: Sun, 16 Feb 2003 12:49:44 +0000
Subject: Re: Help with array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25663@lists.php.net to get a copy of this message
john@jrthorne.com (John Thorne) writes: > $data[$cpt]= > $row[0].",".$row[1].",".$row[2].",".$row[3].",".$row[4]; What you need is a two dimensional array. The code above concatenates the $row elements into a string and puts this string into a one dimensional array. the 2D array $foo[3][5] can be seen as: 0 1 2 3 4 +-+-+-+-+-+ 0 | | | | | | +-+-+-+-+-+ 1 | | | | | | +-+-+-+-+-+ 2 | | | | | | +-+-+-+-+-+ and to put stuff into the two dimensions, you need something like $foo[$i][$j] = "bar"; and iterate over the values $i and $j. -- --Fredrik "Why be a man when you can be a success?" -- Bertold Brecht

« previous php.db (#25663) next »