Save 100s of Dev Hours - Get The React Codebase Generator

check value already exists in codeigniter

check value exists or not in codeign

Callback function of codeigniter which checks whether the value already exists in particular column of table or not.

This function work on add and edit both cases,it return false if value exists and return true if value not exists.

following is the function that you need to put in your controller file:

Note: change the table name in function and in edit case you can change the primary key!= with your table’s key name.

Now time to using this callback function for adding and editing forms.We need to pass the callback function in validation rules.

For the time of adding you can pass the rule in your add action like as:

and in your edit action you can use the rule as following:

Thanks for reading full article , Now use it in your project and if you face any trouble then comment here.

You May Also Like

About the Author: Jeetendra Singh

Jeetendra Singh is a UI Architect who has 10+ Years of Experience as Full Stack Developer. He is a Microsoft certified technology Specialist and AWS Certified Associate Architect. His Major Interests are in Mongo Db, Express Js, React Js, Node Js (MERN STACK). He build variety of applications using Mern, Mean, Node, JavaScript & jQuery