Empty Dates

markbhai1

New Member
I now have an issue where I can't seem to have an empty date, which I want for some of my tables. I can set the dates to 0000-00-00 which I would be happy with, but I get an error message when trying to write the form.

Incorrect datetime value: \'\' for column \'date_nextcall\' at row 1 SQL=UPDATE properties SET `hf_ref`=\'HF256852510\',`branch_id`=\'1\',`property_address`=\'The Hollies\',`post_code`=\'The Hollies\',`status_id`=\'\',`price`=\'285,000\',`fee`=\'4,275\',`date_listed`=\'2006-10-02 00:00:00\',`date_lastpricerev`=\'1970-01-01 00:00:00\',`date_nextpricerev`=\'1970-01-01 00:00:00\',`date_lastad`=\'1970-01-01 00:00:00\',`date_lastcall`=\'1970-01-01 00:00:00\',`date_nextcall`=\'\',`date_exchange`=\'1970-01-01 00:00:00\',`solicitor`=\'\',`date_aml`=\'2008-01-01 00:00:00\',`date_pma`=\'2008-01-01 00:00:00\',`hips_id`=\'1\',`motivation_id`=\'2\',`neg_id`=\'68\',`val_id`=\'70\',`ad_requested`=\'0\',`weight`=\'0\',`notes`=\'\' WHERE property_id=\'1\'

It seems I must have something in the field.

I have checked my mySQL tables and this allows null values or 0000-00-00 values.

I ahve also set a default value in fabrik to 0000-00-00

Any ideas?
 
Additional Info:

I have checked out a few things since and spotted that calendar.js wasn't uploaded, so I have now re-loaded the latest SVN.

Unfortunately the issue still exists.

M
 
Hi Hugh/Rob

Any chance you could quickly cast your eye over this (I know you are busy) and see if you can give me a pointer.

I have identified that the issue is the same on multiple form templates.

I also have the latest SVN (as of last night).

I have also checked MySQL again to see if I can identify any issues with my table.

Do you think it is a Fabrik or a database problem?

It also happens on all date fields ... see below

Incorrect datetime value: \'\' for column \'date_aml\' at row 1 SQL=INSERT INTO properties ( `hf_ref`,`property_address`,`post_code`,`status_id`,`price`,`date_listed`,`val_id`,`hips_id`,`date_aml`,`date_pma`,`motivation_id`,`property_id` ) VALUES ( \'\',\'Test\',\'\',\'inside if 1\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\' ) .

Thanks in advance.

Mark.
 
Well this is strange. I have no problems inserting empty dates. But I made a small change to set the date to $database->nullDate() if its empty, which should fix your problem.

Change is in latest SVN.

-- hugh
 
Hi Hugh.

I think there must be seriously wrong with my installation as although your fix sorted out the problem with date (thank you) it is now failing to save a primary id.

Incorrect integer value: \'\' for column \'property_id\' at row 1 SQL=INSERT INTO properties ( `hf_ref`,`property_address`,`post_code`,`status_id`,`price`,`date_listed`,`val_id`,`hips_id`,`date_aml`,`date_pma`,`motivation_id`,`date_lastpricerev`,`date_nextpricerev`,`date_lastad`,`date_lastcall`,`date_nextcall`,`date_exchange`,`property_id` ) VALUES ( \'hfhfhfh\',\'dhdhdh\',\'chfhf\',\'inside if 1\',\'43434\',\'0000-00-00 00:00:00\',\'\',\'\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',\'\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',\'0000-00-00 0

I think I need to re-build.
 
Hugh.

As you can see from the above post, there are further issues with my site. I think that it may be a good idea to start the site from fresh, I have all of my tables backed up and I can also restore my templates etc, but is there a way in which I can save all of my element customisation etc before I do a re-build?

Is there anything else you think I could check (to fix the problem?) before I press the delete button?

Cheers Guys.

Mark.
 
Is property_id selected as the Primary Key AND set to auto-increment in the Fabrik table admin page (under the Data tab)?

-- hugh
 
Resolved - Please Close

Hi Hugh.

Well, there must have been something wrong with my installation - I made a package file of my site and then uninstalled Fabrik.

This uninstall failed (using the component uninstaller) so I ended up manually uninstalling directly on my web server.

I removed my tables from mySQL manually.

Following this I re-inatalled Fabrik and the latest SVN, followed by installing my package.

This has brought my site back up - and the issue I had has gone.

I can only imagine there were some issues with file versions on my server or my database was corrupt. - I favour the first,

Thanks for your help.

Mark.
 
Back
Top