title: Getting the id of the last record inserted into a MySQL database
body: <p>I'm trying to get the id of the last record inserted into a MySQL database using <code>MAX(id)</code>.
  I can't figure out why my query is not returning any results. Is there something wrong with my PHP?Tthe query works if I try it inside phpmyadmin.</p>
  
  <pre><code>include("db_conx.php"); //Connect to db mysqli
  $sql = "SELECT MAX(id) FROM tbl_uploads";  
  $result = $db_conx-&gt;query($sql);
  $row = $result-&gt;fetch_assoc();
  echo 'last_id: '.$row['id'];
  </code></pre>