The reason I had orginally singled out one column ['usr_d'] is so I could nest 
it inside another loop to see if two values match.  if usr_id matched returned 
value from first loop.
The way I called it was if(!in_array(@$row_rsResults['id_subscribe'],$usrreg)) {
else{................

now Im not sure how to call the individual fields.  I've tried $usrreg['date']; 
but that doesn't seem to work.
Do I need to use keys and values ?

TIA
Mark



-----Original Message-----
From: [EMAIL PROTECTED]
Sent: Friday, April 7, 2006 4:14 PM -07:00
To: Mark Fellowes [EMAIL PROTECTED]
Subject: [PHP-DB] Help: Two dimensional array from table


Yes, all wrong.

The array that mysql_fetch_assoc returns is one dimensional. Not two. So 
you can refer to it like you are. Your problem is in your query more 
than anything. You're doing things the hard way. Keep in mind that 
mysql_fetch_assoc will take care of column names for you so:

$rs_usr_usr = mysql_query("select user_id, usr_date from table");

//Code for registered
$usrreg = array();
do {
 $usrreg[] = $row_usr_usr;
} while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
//end of registered



That's all you need.
-Micah

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
>   


__________________________________________
Organize. Communicate. Share. @ http://www.goowy.com

Reply via email to