Get the last item from table

how do i get the last record add?

I’m using the code below. Is it correct or is there a simpler way?

$select = $this->getDbTable()->select()
     ->from('notafiscal', 'numbernf')
     ->order('numbernf DESC')
     ->limit(1)
        ;
       
$result = $this->getDbTable()->fetchAll($select);

var_dump($result[0][‘numbernf’]);exit;

Is the column ‘numbernf’ a unique, auto-incrementing field?

At first glance, the code seems to be correct. Did you get any error message running the code?