使用状态参数访问表内容时出现问题 [英] Issue in accessing table contents using status parameter
本文介绍了使用状态参数访问表内容时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试显示某个提供商提供的工作。我要做的是在模型中创建函数get_approved_job_proposals。然后,我在控制器中创建了功能manage_job_contracts,但从未成功运行它。
I am trying to display jobs won by a certain provider. What I did was to create function get_approved_job_proposals in my model. Then, I created function manage_job_contracts in my controller, but I never got to successfully run it.
这是我在模型中的代码:
Here's my code in model:
public function get_approved_job_proposals($status)
{
$this->db->select('*')->from('job_proposal')->where('status', $status);
$this->db->where("status" == "Awarded");
$query = $this->db->get();
return $query->result_array();
}
这就是我的控制器中的内容:
and this is what I have in my controller:
public function manage_job_contracts()
{
$this->validateRole('client');
$this->load->model('job_model');
$data['my_preference'] = $this->job_model->get_approved_job_proposals($status);
$data['job'] = $this->job_model->get_job($id);
$this->load->view('client/manage_job_contracts', $data);
}
请帮助我解决此问题。
Kindly help me fix this issue.
推荐答案
这是错误的:
$this->db->where("status" == "Awarded");
正确:
$this->db->where("status", "Awarded");
检查文档: http://ellislab.com/codeigniter/user-guide/database/active_record.html
这篇关于使用状态参数访问表内容时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文