Fixed sql error on front end database search