payment_time
テーブルの作成中に列を設定しTIMESTAMP DEFAULT CURRENT_TIMESTAMP
たテーブルを作成しました。
値を挿入するときは、。payment_time
で空白に設定します''
。ただし、payment_timeのテーブルを確認すると、現在の時刻を探している0000-00-0000:00:00が表示されています。私はここで間違いを犯していますか?
これを試して
payment_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
そのように挿入ステートメントを変更します
INSERT INTO TB (`payment_time`) VALUES ('NOW()' );
--dont specifie the id column it will be automatically inserted
編集。
INSERT INTO TB (`col1`, `col2`,`payment_time`) VALUES ('somevalue1','somevalue2','NOW()' );
-- dont use the id column just the other columns , and be sure that columns are in right ORDER
あなたが編集した質問のため、ここに解決策があります
INSERT INTO donors (firstName,lastName,gender,email,amount,currency)VALUES( 'MD.Borhan', 'Safa', 'm', 'borhansafa@yahoo.com', '5', 'GBP' );
payment_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
payment_time
これを使用してから、挿入ステートメントでは使用しないでください。現在の日付は、それぞれのエントリに自動的に割り当てられます。