我试图在codeigniter中连接来自2个数据库的3个表。 这是我的代码:
Do While .Find.Execute
.Select
'.MoveStartUntil CSet:="0123456789", count:=wdBackward
'.MoveStartUntil CSet:="0123456789", count:=wdForward
'.MoveStart wdCharacter, -1
.MoveStartWhile cset:="123456789", count:=-1
'.MoveStartWhile cset:=Chr$(13) Or " ", count:=wdBackward
'.MoveEndWhile CSet:=Chr$(13), count:=wdBackward
.InsertAfter "]"
.InsertBefore "["
.MoveStart unit:=wdCharacter, count:=.Characters.count
.Select
Loop
我已经在我的database.php文件中添加了第二个数据库。而且我已经在我的模型中添加了这个语句
<?php
public function get_order_products($orders_id) {
$this->db->from('database1.tbl_orders');
$this->db->join('database1.tbl_order_items','database1.tbl_order_items.orders_id=database1.tbl_orders.orders_id','left');
$this->db->join('database2.tbl_customers','database2.tbl_customers.customers_id=database1.tbl_orders.customer_id','left');
$this->db->where('database1.tbl_orders.orders_id',$orders_id);
$result=$this->db->get(); return $result->result(); }
?>
但是我仍然无法从第二个数据库中获取数据。有人可以告诉我为什么会这样吗?