Echo Last Auto-increment ID in PHP

I want the below code to display the last Auto-increment id on a php page. Where am i going wrong?

<?php 
    include '../db_connection.php';
    $sql = "SELECT max(id) FROM  receipt";
    $result = $conn->query($sql);
    echo $result;
?>

You forgot to fetch the result of the query

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.