Tough Select List with multiple arrays

From: Date: Wed, 18 Oct 2000 23:01:49 +0000
Subject: Tough Select List with multiple arrays
Groups: php.general 
Request: Send a blank email to php-general+get-20999@lists.php.net to get a copy of this message
Okay this is a tough one that I am having trouble figuring out exactly. I have this SQL query and array. //Query to get the records of what games the player owns $game_query = mysql_query("SELECT game_id FROM games,members_games WHERE games.gameid=members_games.game_id AND member_id=$member_id GROUP BY game_id",$db); $game_result = mysql_fetch_array($game_query); So now I have a game_result array with numeric values in it. Then I have this form for a member to update their information. It has a list of all game titles. $query1 = "SELECT * FROM games"; $game_query = mysql_query($query1); while($games = mysql_fetch_array($game_query)) { /* Get the game titles and gameids for the check box list menu */ $game_title = $games["title"]; $gameid = $games["gameid"]; /* Output a drop down menu list of all the games that The Grognards supports from the games table. */ print("<INPUT TYPE=\"checkbox\" NAME=\"games[]\" VALUE=\"$gameid\">$game_title<BR>\n"); } What I want to be able to add a bit of code to the second part so that if($game_result == "$gameid") { echo "checked"; } This way in the full list of games is a member has already listed that they have the game is automatically selected. Then the member can add or delete game titles from his profile. How do I do this? Thanks

« previous php.general (#20999) next »