Re: forming a multi-dimensional from a MYSQL DB QUERY

From: Date: Tue, 24 Jul 2001 16:51:29 +0000
Subject: Re: forming a multi-dimensional from a MYSQL DB QUERY
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10716@lists.php.net to get a copy of this message
You've got to call it by $tbl[0]["hardware"] greetings Thomas -- -- 4Ws Netdesign GbR www.webinside.de... ..wir machen Homepages -- "Cody Caughlan" <codyc@cats.ucsc.edu> schrieb im Newsbeitrag news:3916B8D1.6D681792@cats.ucsc.edu... > Hello, > > I am implementing an "excel" like webpage, that is multiple boxes like a > multi-dimensional array. The trick is each row has to have a unique DB > key. > > My problem is this. > > ### BEGIN CODE ### > $rownum = 0; > while($row = @mysql_fetch_array($res, MYSQL_ASSOC)) > { > > $tbl[$rownum] = $row; > $rownum++; > } > ### END CODE ### > > so if I have a field called "hardware" in my table, I should be able to > access it by > > print "$tbl[0][hardware]"; > > (assuming that the DB query succeeded in getting some rows.) > > When I do this, my print statement outputs > > Array[hardware] > > But if I was call a print statement like: > > print "$row[hardware]"; > > INSIDE my while loop above, it outputs as expected. > > What gives? > > Thank you. > - > -------------------------- > Cody Caughlan > codyc@cats.ucsc.edu

« previous php.db (#10716) next »