Jump to content

inserting date with no value


jakebur01

Recommended Posts

How can I insert a date if it doesn't have a value. MySQL column is formatted as date.  I am getting an error while inserting.  Not all of the rows have dates.

	  $ASSIGNED_DATE=$row['ASSIGNED_DATE'];
								   $OPENED_DATE=$row['OPENED_DATE']; 
								    $LAST_SALE_DATE=$row['LAST_SALE_DATE'];
									 $LAST_PMT_DATE=$row['LAST_PMT_DATE'];  
									  $HIGH_BAL_DATE=$row['HIGH_BAL_DATE']; 

 

Link to comment
https://forums.phpfreaks.com/topic/241436-inserting-date-with-no-value/
Share on other sites

How can I insert a date if it doesn't have a value

MySQL ERROR: Incorrect date value: '' for column 'OPENED_DATE' at row 1

The columns are set to allow null.

 

Opened date is the second one.

'2003-11-14', '', '2011-06-28', '2011-06-30', '2010-03-11', '5169'

 

The column is set to allow NULL values, not blank ones.. your query needs to look like this... well at least the snippet you provided does.

'2003-11-14', NULL, '2011-06-28', '2011-06-30', '2010-03-11', '5169'

Notice how NULL has no quotes around it.

 

 

I also believe you could get away with nothing there at all, but I'm not sure.

'2003-11-14', , '2011-06-28', '2011-06-30', '2010-03-11', '5169'

Archived

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

×
×
  • Create New...

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.