尝试使用此查询通过mysql获取数据
$this->db->select("ii.id,oi.user_id as uid,oi.id as oid")->from("order_info oi")->join("iform_info ii","oi.id = ii.order_id")->where("oi.order_no",$id)->get()->row_array();
我在想这样的事情
SELECT * FROM `order_info` JOIN(iform_info) WHERE `order_id` = '1'
答案 0 :(得分:1)
尝试一下:
$this->db->select("ii.id,oi.user_id as uid,oi.id as oid")->from("order_info oi")->join("iform_info ii","oi.id = ii.order_id")->where("oi.order_no",$id)->get()->row_array();
转换为
SELECT ii.id, oi.user_id as uid, oi.id as oid
FROM order_info oi JOIN iform_info ii ON oi.id = ii.order_id
WHERE oi.order_no = $id
您可以在PHP代码中使用此SELECT查询,并动态传递$id
。