我一直在努力将D6升级到D7但是当我运行自定义模块时却收到了错误。我该怎么做才能修复此错误或更改drupal 7知道为db_error的db_error API
这是我的代码
if ($_SESSION['opr'] == 'add') {
db_set_active('data');
db_query("INSERT INTO neraca (tahun,triwulan,item_neraca,nilai,is_final,createdby,createdon,updateby,updateon )
VALUES('$tahun','$triwulan','$itemneraca',$nilai, $isfinal, $inputby,'$inputdate',$updateby,'$updatedate' )");
$error = db_error();
if ($error != NULL) {
db_set_active('default');
drupal_set_message($message='Data belum tersimpan, ada kesalahan !!!', $type='error');
drupal_goto('in_settingdatalaporan');
return;
}
}
else {
db_set_active('data');
db_query("UPDATE neraca set tahun='$tahun',triwulan='$triwulan',item_neraca='$itemneraca',nilai=$nilai,is_final=$isfinal,updateby=$updateby,updateon='$updatedate' where id=$id ");
$error = db_error();
if ($error != NULL) {
db_set_active('default');
drupal_set_message($message='Data belum tersimpan, ada kesalahan !!!', $type='error');
drupal_goto('in_settingdatalaporan');
return;
}
}
db_set_active('default');
drupal_set_message('Submit Data berhasil');
drupal_goto('in_settingdatalaporan');
return;
}