Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, string given in
<p>Trying to get the last row in the table but throwing error ...</p>

<blockquote>
  <p>'Warning: mysqli_fetch_assoc() expects parameter 1 to be
  mysqli_result, string given in '</p>
</blockquote>

<pre><code>$recents = "SELECT * FROM list ORDER BY id DESC LIMIT 1";
if ($result = mysqli_fetch_assoc($recents)) {
    $mName = $result['name'];
    $mDesc = $result['description'];
    $mCost = $result['cost'];
}
</code></pre>