Some updates to db.php for insert id.