Check for unique column value

QuestionsCheck for unique column value
Bill asked 12 years ago

Is there a way to check the value in a column to make sure that no other rows have the same value in the same column?

EXAMPLE: A MySQL table has a UserCode column. Each row in the table must have a unique value for this column. If an attempt is made to enter a UserCode that already exists, then I want to show an error message.

In the UserCode column, I am using a custom edit function.

Any help would be appreciated…thanks!

P.S. — If the custom edit was PHP function, then I could easily do what I need, but it looks like the custom edits all have to be written in JavaScript.

2 Answers
Abu Ghufran answered 12 years ago

Hello,

Please refer demos/editing/server-validation.php.
It has working example how to apply unique and other business checks and show message on client.

Bill answered 12 years ago

Thanks again, Abu…this is exactly what I needed (when reviewing the demo scripts, I missed this somehow).

Your Answer

5 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?