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 7419759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:07:37+00:00 2026-05-29T08:07:37+00:00

I have made a table users with two fields: username and password. I have

  • 0

I have made a table users with two fields: username and password. I have the password set as not null.

The problem is when I enter data and don’t include the password just the username I am able to insert values into the password field.

My goal is to not allow any entries into the database that dont have both a username and passwords. I thought the not null would enforce this but appears to just insert the empty string. Any suggestions?

  • 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-29T08:07:38+00:00Added an answer on May 29, 2026 at 8:07 am

    You should post both your full table definition as well as the code that actually inserts a record.

    However, most likely you either have a default value assigned as a blank string to the table. OR you are passing a blank string, as opposed to null, in your insert statement.

    If the latter you should know that null is not the same as an empty string.

    Another idea is to simply add an insert trigger where you test the password value to see if it meets requirements. If not, cancel the insert. I would normally have suggested that you use a check contraint, but apparently MySql doesn’t actually honor those.

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

Sidebar

Related Questions

I have two tables in my MySQL database, users and tweets, as follows: TABLE
I have made a dump of my database in which one table is pretty
In the page Toggle Squares , I have a table made out of an
I have a trigger that stores changes made in a separate table when a
Hi I made this site a while ago in my table days but have
Question for YUI experts... I have a table and I've made each cell of
I have a database with two tables, Users and Posts. I'd like to write
I have a database where users are presented with two items and choose the
I have a MySQL table with the following fields: id, morning, evening, event, other-fields
I have these two database tables: locations id name users id location_id last_name first_name

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.