Home > Backend Development > PHP Tutorial > Form validation in CI - unqiue

Form validation in CI - unqiue

WBOY
Release: 2016-09-02 08:57:06
Original
1302 people have browsed it

When it comes to is_unique in form validation, it goes directly to the database to query, but I want to exclude myself, what should I do?
For example, my username (unique field) is Beetle and the id is 1. When modifying user information, if I use unique directly, it will directly prompt that it is occupied. How can I exclude myself and check the uniqueness? That is, such a sql To verify the uniqueness - select username from xxx where username='Beetle' and id!=1
Thank you everyone

Reply content:

When it comes to is_unique in form validation, it goes directly to the database to query, but I want to exclude myself, what should I do?

For example, my username (unique field) is Beetle, and the id is 1. When modifying user information, if I use unique directly, it will directly prompt that it is occupied. How can I exclude myself and check the uniqueness? That is such a sql To verify the uniqueness - select username from xxx where username='Beetle' and id!=1
Thank you everyone

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template