1

i have a address field and null is set to no. but when i insert record to table with empty address field , record added to table. and address column is empty. why record add to table despite address empty?

1
  • More details??! This is very vague. Commented Apr 18, 2011 at 9:22

3 Answers 3

2

Could depend on how you add the data, for example if you entered the string as '' its not null, its just empty.

Sign up to request clarification or add additional context in comments.

Comments

2

It is possible to insert an empty string into a nullable field.

Insert into myTable (address) Values ('')

will work even if Address is not nullable.

Check if your field is really null.

Select * from myTable where address is null

Comments

1

Null and empty are two different things, you need to validate with php before sending data to database. ie;

if (empty($_POST['address'])) {
}

1 Comment

null and empty ae different? if i dont fill address field , it is empty or null?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.