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
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    result player names outpincorrect

    HI People,
    I need help please: I am trying to select only players that are playing a certain fixture but my result gives me all the players for all the fixtures:

    PHP Code:
    $fixture_id $_GET['fixture_id']; 
    // get results from fixtures database        
    $result mysql_query("SELECT * FROM fixtures WHERE `fixture_id` = '$fixture_id'")                 
    or die(
    mysql_error());                          

    # Get Results From Database
    $result2 mysql_query("SELECT * FROM `team_selection` WHERE `fixture_id` = '$fixture_id' ORDER BY `selection_id` DESC  ");

    while (
    $show mysql_fetch_object($result2)) {
    print 
    "<h2>Selected Players for game</h2>";

    // display data in table        
    echo "<table border='1' cellpadding='10'>";        
    echo 
    "<tr> <th>fixture_id</th> <th>opponents</th> <th>date</th> <th>venue</th> <th> players</th> <th></th></tr>";       

        
    // loop through results of fixtures, displaying them in the table        
        
    while($row mysql_fetch_array$result )) { 

        
    // echo out the contents of each row into a table
            
    echo "<tr>";
            echo 
    '<td>' $row['fixture_id'] . '</td>';
            echo 
    '<td>' $row['opponents'] . '</td>';
            echo 
    '<td>' $row['date'] . '</td>';
            echo 
    '<td>' $row['venue'] . '</td>';
            
    //Start the count for the loop
            
    $count 1;
            
    //Assign variable to collect players selected
            
    $theplayer "";
            
    //Run through all the 5 players selected
                
    while ($count <= "5") {
                    
    $result3 mysql_query("SELECT `players`.`name`,`players`.`surname`,`players`.`position`
                                            FROM `players`,`team_selection`
                                            WHERE `players`.`player_id` = `team_selection`.`player$count` "
    );

                    while (
    $player mysql_fetch_row($result3)){
                        
    $theplayer    .= $player[0] ." "$player[1] ." ("$player[2] ."), ";
                    }
                    
    $count++; //increment the counter
                
    }
                    echo 
    '<td>'$theplayer .'</td>';
                    
            echo 
    "</tr>";
             }
                     
    // close table>
            
    echo "</table>";
    }        
    ?> 
    My team_selected table has a player1 to player5 that uses the player_id from the players table.

    THANX

  • #2
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dont worry....i fixed it

    i sorted it guys....i omitted the matching of fixture_id in the selection statement.
    Thanx


  •  

    Posting Permissions

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