I'm messing around with PHP and a test MYSQL database. I've created a table called 'names' with columns firstname and lastname; both are set as NOT NULL. However, I create a PHP form to enter in a first and last name, then it sends the data to the appropriate table fields via the $_POST method. If I enter no information for both fields, the database still accepts the input and creates the row with no data in each field.
Why should I assign NOT NULL to columns if I'm going to have to put checks in place for null entries in the PHP form?
NULLwith empty string. Please read http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html