Updating gallery and Complete SQL