You should always back up your iPhone before taking it to an Apple Store for possible repair or replacement. The iPhone will be erased during any repairs carried out.
Apple's Limited Warranty for iPhone covers your iPhone for one year. Warrantyservice for eligible repairs is available at no charge for twelve months from the date of original retail purchase ("date of purchase").