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

  • Home
  • SEARCH
  • 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 6140397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:06:49+00:00 2026-05-23T18:06:49+00:00

In my application in-spite of the strict validation on client and server side both,

  • 0

In my application in-spite of the strict validation on client and server side both, somehow it’s happen that record is going blank from user registration page. All data is blank accept the default value in my table (eg. Gender – Male). This happens approximately 1 in 100 registration.

Mysql – I have structure like not null for every required field. Still it’s inserting blank.

Cakephp side – I am checking data array is blank or not before saving it.

I will really appreciate if anyone help me out.

Thanks in advance.

  • 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-23T18:06:49+00:00Added an answer on May 23, 2026 at 6:06 pm

    It’s blank because in every database (except Oracle) an empty string '' is not null. Therefore the database will accept that.

    If you want to prevent this from happening you need to write a trigger like so:

    DELIMITER $$
    
    CREATE TRIGGER bi_table1_each BEFORE INSERT ON table1 FOR EACH ROW
    BEGIN
      //this will cause an error and prevent the insertion of an empty gender field.
      //If gender has a default value, the database will insert the default value instead.
      IF new.gender = '' THEN SET new.gender = null;
    END $$
    
    DELIMITER ;
    

    Alternatively you can make gender a enum field

    ALTER table1 
    CHANGE COLUMN gender gender ENUM ('M','F');
    

    Links:
    http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
    http://dev.mysql.com/doc/refman/5.5/en/triggers.html

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

Sidebar

Related Questions

I am creating an application that gets thousands of word documents from an Oracle
I'm loading in profile images from both facebook and twitter into a flex application.
Recently I just got assigned a project to develop a web application/site that uses
Has anyone here created a Flash site or application that is ADA (Section 508)
I have an application that searches a database of addresses. The page visitor enters
I have customized the contextual menu for my Cocoa application such that only certain
I have the following situation. I have an application that runs mostly on one
I would like to add some code to my Application.cfc onRequestEnd function that, if
System.out.println(s.toString().substring(0,s.indexOf(.mp3))); i am downloading file from android application.. i need to name them as
I'm creating a web application that requires the use of the perl module Crypt-SSLeay.

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.