I'm trying to modify my website with zencart and by all means, i think this should work, but its not. I was wondering if someone could tell me where I am going wrong

PHP Code:
        $sql "select max(customer_id) as total from zen_customers";
        
$zen_user_id = ($db->sql_query($sql) + 1); 
when i test this in phpMyAdmin, the value seems to be the last in the table plus one, but when I run it through my website it gives me an earlier number, which causes problems. For some reason I can't find the problem, can someone tell me where I went wrong?