2013-10-10 43 views
0

我想值插入db.I有一個表作爲registration_patients.My代碼:笨顯示proble機智日期功能

$data = array(
    'patients_first_name' => $this->input->post('first_name'), 
    'patients_last_name' => $this->input->post('last_name'), 
    'patients_email' => $this->input->post('email'), 
    'patients_password'=> $this->input->post('password'), 
    'patients_birth_date'=> date('Y-m-d', strtotime($this->input->post('day') . "-" .$this->input->post('month') . "-" . $this->input->post('year'))), 
    'patients_sex'=> $this->input->post('sex'), 
    'patients_telephone'=> $this->input->post('telephone'), 
    'patients_codice_fiscale'=> $this->input->post('codice_fiscale'), 
    'account_active'=> 0 
    ); 
    return $this->db->insert('registration_patients', $data); 

現在插入值到數據庫總線呈現出一些錯誤,這樣的警告 一個PHP錯誤遇到

嚴重性:警告

消息:的strtotime():這是不是安全的依靠系統的時區 SETT英格斯。您是需要使用date.timezone設置或 date_default_timezone_set()函數。如果您使用這些 方法中的任何一種,並且您仍然收到此警告,則極有可能是 拼寫錯誤的時區標識符。我們選擇了 '歐洲/倫敦' 爲 'BST/1.0/DST',而不是

文件名:型號/ doctors_model.php

行號:22和時遇到一個PHP錯誤

嚴重性:警告

消息:日期():這是不是安全的依靠系統的時區設置 。您是需要使用date.timezone設置或 date_default_timezone_set()函數。如果您使用這些 方法中的任何一種,並且您仍然收到此警告,則極有可能是 拼寫錯誤的時區標識符。我們選擇了 '歐洲/倫敦' 爲 'BST/1.0/DST',而不是

文件名:型號/ doctors_model.php

行號:22

請幫助me.How我可以解決這個問題?

回答

7

在你root_folder/index.phpdate_default_timezone_set('America/New_York');,看看問題解決與否。這裏是available timezoneslink

+1

謝謝man.i把date_default_timezone_set( '美國/紐約');它在config.php.Now中不顯示錯誤。 – ahs

+0

ok。我已經接受了這個答案。謝謝 – ahs

+0

這也可以在你的php.ini文件中設置爲'date.timezone = America/New_York'。您不必再擔心將其添加到每個應用程序,或者更改您的應用程序以適應您所在的任何服務器時區。 – jbo5112