Welcome Guest, Not a member yet? Register   Sign In
Having trouble with Active Record database query
#1

[eluser]lennierb5[/eluser]
I am trying to display a list of data using the table & pagination library. When I run the first query the rows are counted properly and data is returned but when I use the Active Record query nothing is returned.

Is there any way to view the query codeigniter has created before executing it to see where the error is??

Here is my code:

Code:
$query = $this->db->query("
                                  SELECT job_data.job_data_id, a_techs.tech_number, job_data.date, job_data.account_num, job_data.c_address, job_data.c_apt, job_data.job_status
                                  FROM job_data, a_techs
                                  WHERE job_data.tech_id = a_techs.a_techs_id
                                  ");
        $total_rows = $query->num_rows();
        $per_page = 20;
        $query->free_result();
        $this->db->select('job_data.job_data_id, a_techs.tech_number, job_data.date, job_data.account_num, job_data.c_address, job_data.c_apt, job_data.job_status');
        $this->db->from('job_data, a_techs');
        $this->db->where('job_data.tech_id', 'a_techs.a_techs_id');
        $this->db->limit($per_page);
        
        if ($this->uri->segment(3) !== FALSE)
        {
           $this->db->offset($this->uri->segment(3));
        }
        
        $query = $this->db->get();


Messages In This Thread
Having trouble with Active Record database query - by El Forum - 05-29-2009, 12:54 PM
Having trouble with Active Record database query - by El Forum - 05-29-2009, 01:02 PM
Having trouble with Active Record database query - by El Forum - 05-29-2009, 01:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB