初学PHP interbase。
我正在做一个项目,我需要在2个单独的数据库中保存数据。我使用默认的MySQL数据库,而另一个使用火鸟。下载此库
这是我的数据库。php在配置文件夹。
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "po_pusat";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
$db['sdisdb']['hostname'] = "myIp";
$db['sdisdb']['username'] = "sysdba";
$db['sdisdb']['password'] = "masterkey";
$db['sdisdb']['database'] = "D:pathtodatabase.fdb";
$db['sdisdb']['dbdriver'] = "firebird";
$db['sdisdb']['dbprefix'] = "";
$db['sdisdb']['pconnect'] = FALSE;
$db['sdisdb']['db_debug'] = TRUE;
$db['sdisdb']['cache_on'] = FALSE;
$db['sdisdb']['cachedir'] = "";
$db['sdisdb']['char_set'] = "utf8";
$db['sdisdb']['dbcollat'] = "utf8_general_ci";
需要多个数据库的功能
function save()
{
/*.....*/
$order= true;
$this->item_model->create_purchaseorder($data['companyid'],$data['username'],$status,$data['tanggal'],$data['reqdate'],$data['duedate']); $data['purchaseorderid']=$this->item_model->get_purchaseorderid();
$this->item_model->create_purchaseorderdb2($data['companyid'],$data['username'],$status,$data['tanggal'],$data['purchaseorderid'],$data['duedate']);
}
模型function create_purchaseorderdb2($company,$username,$status,$tanggal,$purchaseorderid,$duedate){
$this->db2=$this->load->database('sdisdb',TRUE);
$data= array(
'SOHEADERID' => '',
'COMPANYID' => $company,
'ECCODE' => 'IDR',
'STATUS' => $status,
'SODATE' => $tanggal,
'WEBSOHEADERID' => $purchaseorderid
);
$this->db2->insert('SOHEADER',$data);
}
我对create_purchaseorder函数没有问题但是当我运行"save"函数时它给了我这个错误
调用未定义函数ibase_connect()
我已经修改了php.ini文件;extension=php_interbase.dll到extension=php_interbase.dll
确保PHP安装中有php_interbase.dll。供参考:
http://www.php.net/manual/en/install.windows.extensions.php