Look: - before you store the value in the database, remove all newlines. - before you compare a value with a value from the db, remove all newlines. That works. Of course, you have to update your databse in case that you have some entries there already.