• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with Join

#1
[eluser]Unknown[/eluser]
Dear users,

Im having an function which get data from my database and joins different tables. This is the function:

Code:
public function getCallcenterCall() {
    $this->db->select('bedrijf.*, status.status_naam, quickscan.datum_verzonden');
    $this->db->join('quickscan', 'bedrijf.id = quickscan.bedrijf_id');
    $this->db->join('status', 'bedrijf.status = status.status_id');
    $this->db->where('status', '0');

    $query = $this->db->get('bedrijf');

    return $query->num_rows() > 0 ? $query-> result_array() : FALSE;
}

In the table status i got 3 rows: 'id', 'status_id', 'status_naam'. In my view i output the status_naam. But here it gets wrong.

Instead of giving me the 'status_naam' that belongs to 'status_id=0' it gives me the 'status_naam" where 'status_id=1'.

Same goes if i try to get the 'status_naam' for 'status_id=1' then it gives me the "status_naam' from 'status_id=2'.

What am i doing wrong?


Messages In This Thread
Problems with Join - by El Forum - 12-16-2011, 06:48 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.