Re: Help: Two dimensional array from table

From: Date: Sun, 09 Apr 2006 13:55:42 +0000
Subject: Re: Help: Two dimensional array from table
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41671@lists.php.net to get a copy of this message
Mark Fellowes wrote:
I created an array to pull data out of one column in database.
      <?php //Code for registered
$usrregid = array(); do { $usrregid[] = $row_rs_usr_usr["usr_id"]; } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); //end of registered ?> However I now need a second column from the table and think a two dimensional array is the right way to go. Having a problem though in defining. Most of the examples I found don't seem to apply to pulling the values from a db. I tried this and while it returns no errors, it also returns no value. <?php //Code for registered $usrreg = array("id", "date"); do { $usrreg[] = $row_rs_usr_usr["usr_id"]["usr_date]; } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); //end of registered ?> Am I defining wrong or pulling the values wrong ? TIA Mark __________________________________________ Organize. Communicate. Share. @ http://www.goowy.com
Maybe try it this way: <?php //Code for registered $usrreg = array("id", "date"); do { $usrreg[]["id"] = $row_rs_usr_usr["usr_id"] $userrag["date"] = $row_rs_usr_usr["usr_date]; } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); //end of registered ?>

« previous php.db (#41671) next »