I like to convert following MySQL query into a CodeIgniter active record query.
SELECT name,
address,
detail,
status,
startdate
FROM job_step
WHERE username = '$_SESSION[username]'
AND status = 0
My job_step
table consists of several columns, but I only need a few not the entire table. In addition to that, information should be filtered according to session name and status (TINYINT which has 1 and 0).
You can write the above query as:
$this->db->select('name, address, detail, status, startdate');
$this->db->where('username',$_SESSION['username']);
$this->db->where('status','0');
$rset=$this->db->get('job_step');
$result=$rset->result();