• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem inner join mysql

#1
[eluser]mo2men[/eluser]
hey
i use inner join

that my code in Model

Code:
function read_fields($limit,$offset,$fields){  
        $this->db->select('*');
        $this->db->from('gate');
        $this->db->join('fields', 'fields.field = gate.field', 'inner');
        $this->db->order_by('gate.id', 'desc');
        $this->db->limit($limit,$offset);
        $this->db->where('fields.id',$fields);
         $query = $this->db->get();
           if($query->num_rows > 0 ){
                 return $query->result();
             }
             else{
                 return FALSE;
             }

Controller
Code:
$fields = $url = $this->uri->segment(3);
                $limit = 10;
                $total = $this->gate_model->count_fields($fields);
                $query = $this->gate_model->read_fields($limit,$offset,$fields);
                if($query)
                {
                $data['row'] = $query;
                }
                
                $config['base_url'] = base_url().'field/';
                $config['total_rows'] = $total;
                $config['per_page'] = $limit;
                $config['uri_segment'] = 3;
                $config['num_links'] = 4;
                $this->pagination->initialize($config);
                $data['pag_links'] = $this->pagination->create_links();

nice???

on 2 id code work correct

but in other ids not work and i get errors
Severity: Notice

Message: Undefined variable: row


help

Filename: views/fields_view.php

Line Number: 11


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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