title: How to put a value in multiple categories
body: <p>After I solved the problem to view more than 1 game category under the <code>game_category</code> field in my database, I'm facing another issue.
  My website decides which game goes in which category by the <code>$game_category</code> variable, but now, I inserted a game with 4 categories, so instead of "action" under <code>game_category</code> record, I have "action,space,strategy,shooting", so the game is sitting nowhere...</p>
  
  <p>This is a part of my code that shows the logic of viewing results by game_category:</p>
  
  <pre><code>if(isset($_GET['genre'])){
  
   $game_category = $_GET['genre'];
  
   $select_games = "SELECT * FROM games WHERE game_category='$game_category' ORDER BY game_name ASC";
  </code></pre>
  
  <p>How can I make a system to read a record with more than one category?</p>
  
  <p>Any ideas? :(</p>
  
  <p>EDIT: Since there is not enough information in my question I will post here 2 php files that involved in the problem:
  1. "insert_games.php" - Used to upload new games via admin panel (works perfectly).
  2. "categories.php" - Used to view games on the right category they are belong to.</p>
  
  <p>This is insert_games.php:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  if(!isset($_SESSION['user_name'])){
  
  header("location:login.php");
  
  }
  else {
  ?&gt;
  &lt;?php
  include("../includes/connect.php");
  
  if(isset($_POST['submit'])){
  
  $game_name = $_POST['game_name'];
  $game_category = implode(",",$_POST['game_category']);
  $game_keywords = $_POST['game_keywords'];
  $game_image = $_FILES['game_image']['name'];
  $image_tmp = $_FILES['game_image']['tmp_name'];
  $game_code = $_FILES['game_code']['name'];
  $code_tmp = $_FILES['game_code']['tmp_name'];
  $game_file = $_FILES['game_file']['name'];
  $file_tmp = $_FILES['game_file']['tmp_name'];
  $game_desc = $_POST['game_desc'];
  
  if($game_name=='' or $game_category=='' or $game_keywords=='' or $game_image=='' or $game_code=='' or $game_file==''){
  
  echo "&lt;script&gt;alert('Please enter all the fields below!')&lt;/script&gt;";
  
  exit();
  
  }
  else {
  
   $path = "../games/$game_name";
  
   mkdir("$path", 0777);
  
   move_uploaded_file($image_tmp,"../images/games_images/$game_image");
  
   move_uploaded_file($code_tmp,"$path/$game_code");
  
   move_uploaded_file($file_tmp,"$path/$game_file");
  
   $insert_query = "insert into games (game_name,game_category,game_keywords,game_image,game_code,game_file,game_desc) values ('$game_name','$game_category','$game_keywords','$game_image','$game_code','$game_file','$game_desc')";
  
   if($game_category == '3d'){
  
   $three_d_status = 'checked';
  
   }
   if($game_category == 'action'){
  
   $action_status = 'checked';
  
   }
   if($game_category == 'adventure'){
  
   $adventure_status = 'checked';
  
   }
   if($game_category == 'arcade'){
  
   $arcade_status = 'checked';
  
   }
   if($game_category == 'brain'){
  
   $brain_status = 'checked';
  
   }
   if($game_category == 'cards'){
  
   $cards_status = 'checked';
  
   }
   if($game_category == 'destruction'){
  
   $destruction_status = 'checked';
  
   }
   if($game_category == 'education'){
  
   $education_status = 'checked';
  
   }
   if($game_category == 'extreme'){
  
   $extreme_status = 'checked';
  
   }
   if($game_category == 'fighting'){
  
   $fighting_status = 'checked';
  
   }
   if($game_category == 'flying'){
  
   $flying_status = 'checked';
  
   }
   if($game_category == 'girls'){
  
   $girls_status = 'checked';
  
   }
   if($game_category == 'holidays'){
  
   $holidays_status = 'checked';
  
   }
   if($game_category == 'hidden_objects'){
  
   $hidden_objects_status = 'checked';
  
   }
   if($game_category == 'motocross'){
  
   $motocross_status = 'checked';
  
   }
   if($game_category == 'multiplayer'){
  
   $multiplayer_status = 'checked';
  
   }
   if($game_category == 'new'){
  
   $new_status = 'checked';
  
   }
   if($game_category == 'puzzle'){
  
   $puzzle_status = 'checked';
  
   }
   if($game_category == 'racing'){
  
   $racing_status = 'checked';
  
   }
   if($game_category == 'fps'){
  
   $fps_status = 'checked';
  
   }
   if($game_category == 'space'){
  
   $space_status = 'checked';
  
   }
   if($game_category == 'sports'){
  
   $sports_status = 'checked';
  
   }
   if($game_category == 'strategy'){
  
   $strategy_status = 'checked';
  
   }
   if($game_category == 'stunt'){
  
   $stunt_status = 'checked';
  
   }
   if($game_category == 'top_rated'){
  
   $top_rated_status = 'checked';
  
   }
   if($game_category == 'words'){
  
   $words_status = 'checked';
  
   }
   if($game_category == 'zombies'){
  
   $zombies_status = 'checked';
  
   }
  
   if(mysql_query($insert_query)){
  
   echo "&lt;script&gt;alert('The Game Uploaded Successfully!')&lt;/script&gt;";
  
   echo "&lt;script&gt;window.open('view_games.php','_self')&lt;/script&gt;";
  
   }
  
  }
  
  }
  
  ?&gt;
  
  &lt;?php } ?&gt;
  
  &lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;link href="css/insert_game.css" rel="stylesheet" type="text/css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form method="post" id="insert_form" action="insert_games.php" enctype="multipart/form-data"&gt;
  
  &lt;table id="insert_games_table" width="680" border="1" align="center"&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_games_table_title" colspan="2" align="center"&gt;Insert New Game&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game name:&lt;/td&gt;
   &lt;td&gt;&lt;input type="text" name="game_name" size="80"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game category:&lt;/td&gt;
   &lt;td id="insert_cat_select"&gt;&lt;input class="checkbox" type="checkbox" name="game_category[]" value="3d"&lt;?php print $three_d_status; ?&gt;/&gt;&lt;span&gt;3D&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="action"&lt;?php print $action_status; ?&gt;/&gt;&lt;span&gt;Action&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="adventure"&lt;?php print $adventure_status; ?&gt;/&gt;&lt;span&gt;Adventure&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="arcade"&lt;?php print $arcade_status; ?&gt;/&gt;&lt;span&gt;Arcade&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="brain"&lt;?php print $brain_status; ?&gt;/&gt;&lt;span&gt;Brain&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="cards"&lt;?php print $cards_status; ?&gt;/&gt;&lt;span&gt;Cards&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="destruction"&lt;?php print $destruction_status; ?&gt;/&gt;&lt;span&gt;Destruction&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="education"&lt;?php print $education_status; ?&gt;/&gt;&lt;span&gt;Education&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="extreme"&lt;?php print $extreme_status; ?&gt;/&gt;&lt;span&gt;Extreme&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="fighting"&lt;?php print $fighting_status; ?&gt;/&gt;&lt;span&gt;Fighting&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="flying"&lt;?php print $flying_status; ?&gt;/&gt;&lt;span&gt;Flying&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="girls"&lt;?php print $girls_status; ?&gt;/&gt;&lt;span&gt;Girls&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="holidays"&lt;?php print $holidays_status; ?&gt;/&gt;&lt;span&gt;Holidays&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="hidden_objects"&lt;?php print $hidden_objects_status; ?&gt;/&gt;&lt;span&gt;Hidden Objects&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="motocross"&lt;?php print $motocross_status; ?&gt;/&gt;&lt;span&gt;Motocross&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="multiplayer"&lt;?php print $multiplayer_status; ?&gt;/&gt;&lt;span&gt;Multiplayer&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="new"&lt;?php print $new_status; ?&gt;/&gt;&lt;span&gt;New Games&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="puzzle"&lt;?php print $puzzle_status; ?&gt;/&gt;&lt;span&gt;Puzzle&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="racing"&lt;?php print $racing_status; ?&gt;/&gt;&lt;span&gt;Racing&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="fps"&lt;?php print $fps_status; ?&gt;/&gt;&lt;span&gt;FPS&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="space"&lt;?php print $space_status; ?&gt;/&gt;&lt;span&gt;Space&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="sports"&lt;?php print $sports_status; ?&gt;/&gt;&lt;span&gt;Sports&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="strategy"&lt;?php print $strategy_status; ?&gt;/&gt;&lt;span&gt;Strategy&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="stunt"&lt;?php print $stunt_status; ?&gt;/&gt;&lt;span&gt;Stunt&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="top_rated"&lt;?php print $top_rated_status; ?&gt;/&gt;&lt;span&gt;Top Rated&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="words"&lt;?php print $words_status; ?&gt;/&gt;&lt;span&gt;Words&lt;/span&gt;&lt;br&gt;
   &lt;input class="checkbox" type="checkbox" name="game_category[]" value="zombies"&lt;?php print $zombies_status; ?&gt;/&gt;&lt;span&gt;Zombies&lt;/span&gt;&lt;br&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game keywords:&lt;/td&gt;
   &lt;td&gt;&lt;textarea id="insert_text_area" name="game_keywords"&gt;&lt;/textarea&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game image:&lt;/td&gt;
   &lt;td&gt;&lt;input type="file" name="game_image"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game HTML:&lt;/td&gt;
   &lt;td&gt;&lt;input type="file" name="game_code"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game Flash File:&lt;/td&gt;
   &lt;td&gt;&lt;input type="file" name="game_file"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td id="insert_cat_name"&gt;Game description:&lt;/td&gt;
   &lt;td&gt;&lt;textarea id="insert_text_area" name="game_desc"&gt;&lt;/textarea&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td colspan="2" align="center"&gt;&lt;input type="submit" name="submit" value="Publish Game Now" id="insert_submit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I know its a bit too long because there are many categories using the HTML form and the "if" statement...</p>
  
  <p>This is the categories.php:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
   &lt;div class='container'&gt; &lt;!--Start of the container--&gt;
  
   &lt;div&gt;&lt;?php include("includes/header.php"); ?&gt;&lt;/div&gt;
   &lt;div&gt;&lt;?php include("includes/navbar.php"); ?&gt;&lt;/div&gt;
   &lt;div&gt;&lt;?php include("includes/right_col.php"); ?&gt;&lt;/div&gt;
  
   &lt;div class='main_col'&gt; &lt;!--Start of the Main Column--&gt;
  
   &lt;div&gt;&lt;?php echo '&lt;img id="category_title" src="images/genres/' . $_GET[genre] . '.png"'; ?&gt;&lt;/div&gt;
  
   &lt;div class='main_content'&gt;
   &lt;?php
   include("includes/connect.php");
  
   if(isset($_GET['genre'])){
  
   $game_category = $_GET['genre'];
  
   $select_games = "SELECT * FROM games WHERE game_category IN ($game_category) ORDER BY game_name ASC";
  
   $run_games = mysql_query($select_games);
  
   echo '&lt;table&gt;';
  $games = 0;
  while($row = mysql_fetch_array($run_games)){
     // make a new row after 9 games
     if($games%9 == 0) {
        if($games &gt; 0) {
           // and close the previous row only if it's not the first
           echo '&lt;/tr&gt;';
        }
        echo '&lt;tr&gt;';
     }
     // make a new column after 3 games
     if($games%3 == 0) {
        if($games &gt; 0) {
           // and only close it if it's not the first game
           echo '&lt;/td&gt;';
        }
        echo '&lt;td&gt;';
     }
  
     $game_id = $row['game_id'];
     $game_name = $row['game_name'];
     $game_category = $row['game_name'];
     $game_keywords = $row['game_name'];
     $game_image = $row['game_image'];
     ?&gt;
  &lt;div class="game_grid"&gt;
     &lt;div id="game_name"&gt;&lt;a href="game_page.php?id=&lt;?php echo $game_id; ?&gt;"&gt;&lt;?php echo $game_name; ?&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
     &lt;div id="game_image"&gt;&lt;a href="game_page.php?id=&lt;?php echo $game_id; ?&gt;"&gt;&lt;img src="images/games_images/&lt;?php echo $game_image; ?&gt;" width="120" height="120" /&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
     &lt;?php 
  $games++;  
  }
  
  }
  ?&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/div&gt; &lt;!--End of the Main Column--&gt;
  
   &lt;/div&gt; &lt;!--End of the container--&gt;
  
   &lt;div&gt;&lt;?php include("includes/footer.php"); ?&gt;&lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Note: I removed everything from the  tags, because its private and its not relevant to the question :)...</p>