title: Android MySQL + PHP + JSON
body: <p>I've been working on this Android app with MySQL -> PHP and JSON for a school assignment. I'm NOT experienced with PHP and I can't find the error in this php file.</p>
  
  <pre><code>&lt;?php
  
  require("db_config.php");
  
  //initial query
  $query = "SELECT * FROM GAME G, CONSOLE C WHERE G.consoleid = C.consoleid";
  
  //execute query
  try 
  {
      $stmt   = $db-&gt;prepare($query);
      $result = $stmt-&gt;execute($query);
  }
  catch (PDOException $ex) 
  {
      $response["success"] = 0;
      $response["message"] = "Database Error!";
      die(json_encode($response));
  }
  
  $rows = $stmt-&gt;fetchAll();
  
  
  if ($rows) 
  {
      $response["success"] = 1;
      $response["message"] = "Games Available!";
      $response["games"]   = array();
  
  foreach ($rows as $row) 
  {
      $gameslist          = array();
      $games["gameid"]        = $row["gameid"];
      $games["gamename"]          = $row["gamename"];
      $games["gamevalue"]         = $row["gamevalue"];
      $games["gamerarity"]        = $row["gamerarity"];
      $games["gamedescription"]   = $row["gamedescription"];
      $games["consolename"]       = $row["consolename"];
      $games["gameimgstring"]     = $row["gameimgstring"];
  
      //update our repsonse JSON data
      array_push($response["games"], $gameslist);
  }
  
      // echoing JSON response
      echo json_encode($response);   
  } 
  else 
  {
      $response["success"] = 0;
      $response["message"] = "No games Available!";
      die(json_encode($response));
  }
  
  ?&gt;
  </code></pre>
  
  <p>The PHP script should return an Array filled with game data. It doesn't need any data for the Query.</p>
  
  <p>My IDE gives an error on this part</p>
  
  <pre><code>try 
  {
      $stmt   = $db-&gt;prepare($query);
      $result = $stmt-&gt;execute($query);
  }
  </code></pre>
  
  <p>Because this fails it doesn't return a value.</p>