error in query while selecting an ad.