Jump to content

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'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.