title: php mysql query returns nothing, phpmyadmin with same query returns result
body: <p>I am trying to delete a file or copy a row into a new table, depending on a $_GET.
  The $_GET works fine, and I'm not including all the code, I know it isn't relevant.
  The table copy works, but the select statement that gets called when the $_GET is a different value returns nothing, except when I copy the query directly into phpmyadmin. </p>
  
  <p>Base code:</p>
  
  <pre><code>$pID = $_GET['pID'];
  
  $con = mysqli_connect("...","...","...","...");
  </code></pre>
  
  <p>The following works:</p>
  
  <pre><code>$query = 'INSERT INTO `photos` (`id`, `photo1`, `photo2`, `demographic_id`)
  SELECT `id`, `photo1`, `photo2`, `demographic_id`
  FROM `photos_queue`
  WHERE `photos_queue`.`demographic_id` = '.$pID;
  
  mysqli_query($con, $query);
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>$query = 'SELECT `photo1` FROM `photos_queue` WHERE `demographic_id` = '.$pID;
  $result = mysqli_query($con, $query);
  print($result);
  unlink($result);
  </code></pre>
  
  <p>I've printed $query and the value of it is valid; I can copy it directly into phpmyadmin and it will work fine.</p>