added db code to all pages