0

我有我的模型:

$this->db->select('companyName,companySlogan,companyContact,companyEmail,companyWebsite,companyPhone,companyFax,companyAddress');
$result = $this->db->get('companyDetails');

我将如何返回我的$result以便我可以通过我的控制器以以下形式调用它?

$data['companyName'] = $this->quote->companyDetails->companyName
4

1 回答 1

1

您可能可以getCompanyDetails($companyName)在模型中创建一个函数。然后从您的控制器调用此方法。$this->quote->getCompanyDetails('abc');

像下面的东西。请注意,请对此进行测试,如果出现错误,请进行细微更改。基本思想如下。

public function getCompanydetails($companyName)
{ 
$this->db->select('companyName,companySlogan,companyContact,companyEmail,companyWebsite,companyPhone,companyFax,companyAddress');
    $result = $this->db->get($companyName);
    return result->result_array();
}
于 2012-04-07T01:48:27.597 回答