嗨,我在将日期从 drupal 插入到 mysql 时遇到了一点麻烦,这是我正在尝试的代码
.....
$form['kotak']['tgl'] = array(
'#type' => 'date',
'#title' => t('Tanggal'),
);
.....
function awal_form_submit($form,&$form_state){
global $user;
$entry = array(
'tanggal' => $form_state['values']['tgl'],
);
$tabel = 'jp_1';
$return = insert_form($entry,$tabel);
}
.....
function insert_form($entry,$tabel){
$return_value = NULL;
try {
$return_value = db_insert($tabel)
->fields($entry)
->execute();
}
.....
每次我提交时,都会出现这样的错误代码
db_insert 失败。消息 = SQLSTATE [21S01]:插入值列表与列列表不匹配:1136 列计数与第 1 行的值计数不匹配,查询 = INSERT INTO {jp_1}(tanggal)值(:db_insert_placeholder_0_month,:db_insert_placeholder_0_day,:db_insert_placeholder_0_year)
有什么建议或更正吗?