FireBird CodeIgniter多个数据库连接

时间:2014-03-21 07:07:13

标签: php mysql codeigniter firebird

PHP interbase中的Noob。

我正在开展一个项目,我需要将数据保存在2个独立的数据库中。 我使用默认的MySQL数据库,而另一个使用firebird。 已下载this library

这是我在config文件夹中的database.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:\path\to\database.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函数没有任何问题 但是当我运行“保存”功能时,它会给我这个错误

  

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

我已经修改了php.ini文件 ; extension = php_interbase.dll to extension = php_interbase.dll

1 个答案:

答案 0 :(得分:0)

确保PHP安装中有php_interbase.dll。供参考:

http://www.php.net/manual/en/install.windows.extensions.php