Welcome Guest, Not a member yet? Register   Sign In
Database Value is not showing up
#1

[eluser]Unknown[/eluser]
Hi, I have a link, when any user clicks on it takes to my following controller and after some database query it shows some information relevant to a particular studentid(I have set that studentid number in my controller and model for querying database) . When I click on the link- in the address bar it looks like this- http://localhost/sundial/Student_fee_status/

For Rest of the question please check below:

My Controller:
Code:
class Student_fee_status extends CI_Controller {

    function index(){
      
      $this->load->library('pagination');
      $config['base_url'] = base_url().'student_fee_status/index';    
      
       $this->db->select('*');
       $this->db->from('studentpayment1');
            
       $this->db->where('studentid', '1006');
      
          $query = $this->db->get('');
          $numrows=$query->num_rows();    
    
      $config['total_rows'] = $numrows;
      $config['per_page'] = 20;
      $config['num_links'] = 20;
      $config['full_tag_open'] = '<div class="pagination" align="center">';
      $config['full_tag_close'] = '</div>';
      $this->pagination->initialize($config);    
        
    
    $this->load->model('Mod_student_fee_status');
    $data['records']= $this->Mod_student_fee_status->fee_status($config['per_page'],$this->uri->segment(3));
    
              
    $data['main_content']='view_student_fee_status';
    $this->load->view('includes/template',$data);
      
     }


My Model:
Code:
//Function Student Fee
       function fee_status($perPage,$uri) {
       $this->db->select('*');
       $this->db->from('studentpayment1');
          
      
       $this->db->where('studentid', '1006');
      
                
       $getData = $this->db->get('', $perPage, $uri);
       if($getData->num_rows() > 0)
       return $getData->result_array();
       else
       return null;
       }
       //End of Function


The above code is working very well but now I instead of setting the studentid value before I want to send the value through URL- So I made some changes in my controller like following and when I clicked on the link.. in the browser the link looks like this- http://localhost/sundial/Student_fee_status/index/1006.
But it is displaying no result.

Would you please kindly help me figure the problem?

Thanks in Advance Smile

Controller
Code:
function index($id){
      
      $this->load->library('pagination');
      $config['base_url'] = base_url().'student_fee_status/index';    
      
       $this->db->select('*');
       $this->db->from('studentpayment1');
            
       $this->db->where('studentid', $id);
      
          $query = $this->db->get('');
          $numrows=$query->num_rows();    
    
      $config['total_rows'] = $numrows;
      $config['per_page'] = 20;
      $config['num_links'] = 20;
      $config['full_tag_open'] = '<div class="pagination" align="center">';
      $config['full_tag_close'] = '</div>';
      $this->pagination->initialize($config);    
        
    
    $this->load->model('Mod_student_fee_status');
    $data['records']= $this->Mod_student_fee_status->fee_status($id,$config['per_page'],$this->uri->segment(3));
    
              
    $data['main_content']='view_student_fee_status';
    $this->load->view('includes/template',$data);
      
     }

My Model

Code:
//Function Student Fee
       function fee_status($id,$perPage,$uri) {
       $this->db->select('*');
       $this->db->from('studentpayment1');
          
      
       $this->db->where('studentid', $id);
      
                
       $getData = $this->db->get('', $perPage, $uri);
       if($getData->num_rows() > 0)
       return $getData->result_array();
       else
       return null;
       }
       //End of Function




Theme © iAndrew 2016 - Forum software by © MyBB