populate array using for loop, not acting as expected

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   populate array using for loop, not acting as expected
mearnheart
CZ Newbie
mearnheart has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Jul 29, 2005
0.00 posts per day
Posts: 6
Points: 261
   
MS server
Nuke 7
PHP 4
MySQL ??

sample code:

    //GET ARRAY OF USERS
    $user_query = "SELECT user_id, name FROM nuke_users ORDER BY wac_l_name";
    if(!$user_results = $db->sql_query($user_query)) echo "ERROR - ".mysql_error()."<BR>";
    $user_numrows = $db->sql_numrows($user_results);

    for($x=0; $x<$user_numrows; $x++)
    {
      $row = $db->sql_fetchrow($user_results);
      echo "USER: ".$row['user_id']."-".$row['name']."<BR>";
      $tempid=$row['user_id'];
      $tempname=$row['name'];
      echo "--------$tempid-$tempname<BR>";
      $user_id[$x] = $tempid;
      $user_name[$x] = $tempname;
      echo "--------$user_id[$x]-$user_name[$x]<BR>";
    }


sample output:

USER: 1-
--------1-
--------1-
USER: 82-Administrator
--------82-Administrator
--------8-A
USER: 127-Brandon Albert
--------127-Brandon Albert
--------1-B
USER: 6-Tom Allred
--------6-Tom Allred
--------6-T


what am I mssing here?
Can someone explaine to me why the $user_id and $user_name arrays being populated as expected?


Back to top Reply with quote
#2   (resolved)....... populate array using for loop
mearnheart
CZ Newbie
mearnheart has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Jul 29, 2005
0.00 posts per day
Posts: 6
Points: 261
   
Issue resolved.
Programmer error.
Thanks for reading.

mike



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum