title: php warning: mysqli_close() expects parameter 1 to be mysqli
body: <p>I am attempting a connection to a sql db via php and keep getting an error I can't figure out.  I can connect with another debug scripts with no errors.  I get my connection and pull my data but pulls an error at the end.</p>
  <pre><code>$con=mysqli_connect(&quot;localhost&quot;,&quot;username&quot;,&quot;password&quot;,&quot;dbname&quot;);
   
  // Check connection
  if (mysqli_connect_errno())
  {
    echo &quot;Failed to connect to MySQL: &quot; . mysqli_connect_error();
  }
   
  // This SQL statement selects ALL from the table 'Locations'
  $sql = &quot;SELECT * FROM Locations&quot;;
   
  // Check if there are results
  if ($result = mysqli_query($con, $sql))
  {
      // If so, then create a results array and a temporary one
      // to hold the data
      $resultArray = array();
      $tempArray = array();
   
      // Loop through each row in the result set
      while($row = $result-&gt;fetch_object())
      {
          // Add each row into our results array
          $tempArray = $row;
          array_push($resultArray, $tempArray);
      }
   
      // Finally, encode the array to JSON and output the results
      echo json_encode($resultArray);
  }
   
  // Close connections
  mysqli_close($result);
  mysqli_close($con);
  ?&gt;
  </code></pre>
  <p>Brings this out</p>
  <blockquote>
  <p>[{&quot;Name&quot;:&quot;Apple&quot;,&quot;Address&quot;:&quot;1 Infinity Loop Cupertino, CA&quot;,&quot;Latitude&quot;:&quot;37.331741&quot;,&quot;Longitude&quot;:&quot;-122.030333&quot;},{&quot;Name&quot;:&quot;Googleplex&quot;,&quot;Address&quot;:&quot;1600 Amphitheatre Pkwy, Mountain View, CA&quot;,&quot;Latitude&quot;:&quot;37.421999&quot;,&quot;Longitude&quot;:&quot;-122.083954&quot;}]</p>
  <p>Warning: mysqli_close() expects parameter 1 to be mysqli, object given in /home/jfletch/public_html/appone/connect.php on line 36</p>
  </blockquote>