Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3397448
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:31:47+00:00 2026-05-18T04:31:47+00:00

I have a Users table in which no two same users can exists ,

  • 0

I have a Users table in which no two same users can exists , what is the best way to do this error free?

What I did is that I wrote a check for duplication in the controller, but someone said to me it’s not a right thing to do. He said put unique on database table? I have implemented this on several other controllers as well. Do I ought to change it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:31:48+00:00Added an answer on May 18, 2026 at 4:31 am

    There are several places where you should do this.

    • at database table level: Use email as username and mark it as unique constrant
    • at model validation level you can check for the email and return validation error
    • at client side, you can place some code using async request that will check for duplicate email or username in real time when user enters username in textbox

    — edit —

    It is suggested to place all three for better validations. Inconsistent data is the worst thing for your system than anything else. Because what I think is, correct data = good quality

    — end edit —

    please keep in mind that validation code should be placed at model and to learn how to write manageable OO code you can see example of mvc store front.

    hope this will help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table which looks like this: mysql> SHOW COLUMNS FROM Users; +------------+--------------+------+-----+---------+----------------+
I have a single table that contains two types of items under the same
I have two tables. One user table and one table in which results are
I have two tables, Users and People, both of which share a common attribute,
So I have a mySQL database with a 'users' table which includes a username,
I have a table users which has a primary key userid and a datetime
I have a picture table which consists for users pictures Table Name:picture Columns: picture_id
I have a innoDB table which records online users. It gets updated on every
I have an application which has a Projects table and a Users table. In
I have a table in which users store scores and other information about said

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.