forming a multi-dimensional from a MYSQL DB QUERY

From: Date: Mon, 08 May 2000 12:53:37 +0000
Subject: forming a multi-dimensional from a MYSQL DB QUERY
Groups: php.db 
Request: Send a blank email to php-db+get-2@lists.php.net to get a copy of this message
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 (#2) next »