致命错误:调用未定义的函数db_error()

时间:2017-03-17 08:20:37

标签: php drupal drupal-7 drupal-6 drupal-modules

我一直在努力将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;
}

0 个答案:

没有答案