title: MYSQL - If I have a column of type json can I Select based on what's in the JSON
body: <p>I have a database that holds recordings and each recording has custom metadata that the user can specify, which will be different every time. Is it possible when I do my GET to Select based on what is in that metadata?</p>
  
  <pre><code>&lt;?php
  require 'config.php';
  require 'database_connector.php';
  
  if (!$_SERVER['REQUEST_METHOD'] === 'GET') {
      var_dump(http_response_code(403));
      die();
  }
  
  $secret = "getSecret";
  if ($secret !== $_GET['secret']) {
      var_dump(http_response_code(401));
      die();
  }
  
  $request = (object) [
      'id' =&gt; $_GET['id'], 'game_name' =&gt; $_GET['game_name'], 'gamer_tag' =&gt; $_GET['gamer_tag'], 'limit' =&gt; $_GET['limit'], 'id' =&gt; $_GET['meta_data']
  ];
  $connection = openConnection($config);
  retrieveRecordings($connection, $config, $request);
  $connection-&gt;close();
  
  function retrieveRecordings($connection, $config, $request)
  {
      $stmt = $connection-&gt;prepare("SELECT * FROM $config-&gt;tablename WHERE id = ? OR game_name = ? OR gamer_tag = ? OR meta_data = ? LIMIT ?");
      $stmt-&gt;bind_param("sssss", $request-&gt;id, $request-&gt;game_name, $request-&gt;gamer_tag, $request-&gt;meta_data, $request-&gt;limit);
      if (!$stmt-&gt;execute()) {
          echo "Execute failed: (" . $stmt-&gt;errno . ") " . $stmt-&gt;error . " \r\n";
          die();
      }
      $result = $stmt-&gt;get_result();
      if ($result-&gt;num_rows &gt; 0) {
          while ($row = $result-&gt;fetch_assoc()) {
              $id = $row["id"];
              $game_name = $row["game_name"];
              $gamer_tag = $row["gamer_tag"];
              $recording = $row["recording"];
              $meta_data = $row["meta_data"];
              $hex = bin2hex($recording);
              echo ("response=id=" . $id . "\r\n");
              echo ("response=game_name=" . $game_name . "\r\n");
              echo ("response=gamer_tag=" . $gamer_tag . "\r\n");
              echo ("response=meta_data=" . $meta_data . "\r\n");
              echo ("response=recording" . $id . "=" . $hex . "\r\n");
          }
      } else {
          echo "0 results \r\n";
      }
  }
  </code></pre>