title: MySQL query is working with MySQL command line but not MySQLi
body: <p>I'm using Google's algorithm for finding nearby locations based on coordinates in my PHP script:</p>
  
  <pre><code>if ($requestType == "closestPeers") {
      $clientsCoordinates = mysqli_fetch_row(mysqli_query($connection,"SELECT latest_latitude,latest_longitude FROM Assets WHERE username='{$username}'"));
      $longitude = $clientsCoordinates[0];
      $latitude = $clientsCoordinates[1];
      $miles = 0.0568182; /* 300 Feet, a bit larger than average Midtown Manhattan blocks */
      $closestUsersQuery = "SELECT *, 
                              ( 3959 * acos( cos( radians('$latitude') ) * 
                              cos( radians( latest_latitude ) ) * 
                              cos( radians( latest_longitude ) - 
                              radians('$longitude') ) + 
                              sin( radians('$latitude') ) * 
                              sin( radians( latest_latitude ) ) ) ) 
                              AS distance FROM Assets HAVING distance &lt; '$miles' ORDER BY distance ASC LIMIT 0, 5";
      $closestUsers = mysqli_fetch_all(mysqli_query($connection,$closestUsersQuery));
      foreach ($closestUsers as $nearbyUser) {
          $responseArray[$nearbyUser[1]] = $nearbyUser[4];
      }
  } else if ($requestType == "cellImage") {
  </code></pre>
  
  <p>But the thing is that this query won't work for whatever reason. I can call <code>mysqli_num_rows()</code> on that <code>mysqli_query()</code> and I'll see <code>10</code>, but when I use this query I'm only given an empty array.</p>
  
  <p>However, I could set <code>$closestUserQuery = "SELECT * FROM Assets"</code> I'm given an array with all rows which is obviously highly inefficient and certainly unsuitable for this particular application. I could also call the query provided by Google in MySQL's command line interface and I'm given exactly what I'm looking for -- The results from the database nearby.</p>
  
  <p>These are the columns for my <code>Assets</code> table:
  <img src="https://i.stack.imgur.com/uTrs3.png" alt="enter image description here"></p>