select articles and photos from db in proper order