It would probably be easier to make 'asset_id' an AUTO_INCREMENT and let the DB take care of this for us.