Jump to content

Archived

This topic is now archived and is closed to further replies.

benjamin_boothe

Error inserting data into db via form

Recommended Posts

This is the error I am getting:

[quote]
Error inserting data - Incorrect date value: '' for column 'date_of_birth' at row 1 with query INSERT INTO policy_holder (id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES ( NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')

[/quote]

I have used NULL as my id (auto_increment) value as this worked when I inserted a record via SQL command line client.

I have used DATE as my character type 'Foramt: YYYY-MM-DD', which I have used.  I cant see where the error is.

Can somebody please help!!!
 

Share this post


Link to post
Share on other sites
Try this:
[code]INSERT INTO policy_holder (id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES ( NULL, '', '', '', '', NOW(), '', '', '', '', '', '', '', '', '', '', '', '')[/code]
I'm not 100% sure but I don't think you can have an empty field that has a date/time datatype.

Share this post


Link to post
Share on other sites
Thankyou very much BUT...

It does add records to the db but, all the entries have come up as NULL barring the date_of_birth field that prints today's date.  I want it to print the date that I put into the form.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.