Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts

    comparing tables help

    I'm trying to compare a user's name to a list of tables, and get total of how many tables the user is found in. I think I'm close, but it keeps returning 0 for each user, when it should return the number of matches.

    I'm still learning to understand arrays better, thus I think I missed something there. But does anyone see something I missed?
    PHP Code:
    $users 0;
                       while (
    $users mysql_num_rows($query1)) {
                        
    $game 0;
                        
    $sql2 "SELECT id FROM ".$this->settings->mysql_prefix."games WHERE id > 0";
                        
    $games mysql_query($sql2);
                        
                        
    $id 0;
                        
    $active_games 0;
                            while (
    $id mysql_num_rows($games)) {
                            
    $sql3 "SELECT * FROM " .$this->settings->mysql_prefix."game_".$game[$id]." WHERE player = ".$player['login']." ";
                            
    $plyr mysql_query($sql3);
                            
    $plyrs = array($plyr);
         
                                if (
    $plrs['player'] == $player['login'] ) {
                                
    $active_games++;
                                }    
                            
    $id++;
                            }
                        
    $users++;
                    } 

  • #2
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    I'm pretty sure you cant just make a query response into an array... try the mysql_fetch_array function instead.
    http://us3.php.net/mysql_fetch_array


    -Adam
    Why not thank me?

    http://adamsworld.name


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •