user2050308
user2050308

Reputation:

PHP Update Query Date is not inserted?

Hello Friends this is my update query.

UPDATE bizz_investor_form set    
  Published_Published='publishedyes',
  Published_Listed_and_Discoverable='listedanddiscoverableno',
  Published_Describe_Start_Date='21-10-2013',
  Describe_end_Date='30-10-2013' 
WHERE user_id =136

When i run that query the date put in database like 0000-00-00 please help any one.

Upvotes: 0

Views: 101

Answers (4)

Donovan Charpin
Donovan Charpin

Reputation: 3397

MySQL's default DATE field format is YYYY-MM-DD.

You can use DATE_FORMAT

DATE_FORMAT('1997-10-04 00:00:00', '%W %M %Y');

Upvotes: 0

Renish Khunt
Renish Khunt

Reputation: 5824

Change date to like.

$startdate = date("Y-m-d",strtotime('21-10-2013'));
$enddate = date("Y-m-d",strtotime('21-10-2013'));

then after write your query like.

"UPDATE bizz_investor_form set    
  Published_Published='publishedyes',
  Published_Listed_and_Discoverable='listedanddiscoverableno',
  Published_Describe_Start_Date='".$startdate."',
  Describe_end_Date='".$enddate."' 
WHERE user_id =136"

Upvotes: 0

CreatoR
CreatoR

Reputation: 1652

Set field type to DATE or change value to 2013-10-30 00:00:00 (mysql dates format yyyy-mm-dd hh:mm:ss)

Upvotes: 0

tCode
tCode

Reputation: 434

Datetime format in mysql is YYYY-MM-DD H:i:s (2013-10-30 11:08:55)

Upvotes: 2

Related Questions