SQL Question regarding not null defaults.
Posted: Fri Dec 17, 2004 5:00 am
Hey gang, I was inserting a customer into my database from my form and the final two values nfor the validated and rank coloumn i entred as null, this caused problems stating that i couldn't do this. However in my script i have a default value for if a null is entered. my sql script is below.
any ideas guys?
Code: Select all
create table customers
(customer_id int(6) not null auto_increment primary key,
first_name varchar(20) not null default'',
surname varchar(20) not null default'',
initial varchar(4) not null default'',
address_line_one varchar(25) not null default'',
address_line_two varchar(25) not null default'',
city varchar(15) not null default'',
county varchar(15) default'',
postcode char(8) not null default'',
home_phone_number char(11) not null default'',
mobile_number char(11) not null default'',
email varchar(40) not null default'',
date_of_birth date not null default'0000-00-00',
username varchar(50) not null default '',
password varchar(20) not null default'',
validated int(1) not null default '0',
rank int(1) not null default '1');