2 回答

TA贡献1828条经验 获得超6个赞
您可以使用 CLASSCATEGORY 和 SELECT CLASSCATEGORY.name AS 类别名称 JOIN 模型中的 USER 表,然后echo $user['categoryname']
. 以下是如何在 CodeIgniter 中连接两个表的示例
$this->db->select('USER.*, CLASSCATEGORY.name AS categoryname') ->from('users') ->join('CLASSCATEGORY', 'CLASSCATEGORY.id = USER.classcategory_id') ->get() ->result();

TA贡献1835条经验 获得超7个赞
public function getallRecords($id,$product_id)
{
$this->db->select('*');
$this->db->from('products');
$this->db->where('id', $id);
$this->db->where('product_id', $product_id);
$this->db->where('show', 'no');
$this->db->where('Results !=', '0');
$this->db->order_by('added', 'DESC');
$this->db->limit(30);
$getallRecords=$this->db->get();
$resultllRecords=$getallRecords->result();
return $resultllRecords;
}
- 2 回答
- 0 关注
- 112 浏览
添加回答
举报