Issue in accessing table contents using status parameter

半腔热情 提交于 2019-12-25 03:03:30

问题


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.


回答1:


This is wrong:

$this->db->where("status" == "Awarded");

Correct:

$this->db->where("status", "Awarded");

Check documentation: http://ellislab.com/codeigniter/user-guide/database/active_record.html



来源:https://stackoverflow.com/questions/22875615/issue-in-accessing-table-contents-using-status-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!