Welcome Guest, Not a member yet? Register   Sign In
CI Urgent help needed....
#1

[eluser]srajibtechno[/eluser]
hi..

I need urgent help for CI ....I already create CI model and controller...and 2 view files for search ....but i can not retrieve my search result .... using 2 select option ...
please check my files ..and give me solution as soon as possible…
I think my view file is not ok...every time when I select dhaka option...then
the area selected for dhaka region and topic selected...
But...when i click on search button then only dhaka result only show...
But rest of the area will not displaying properly...
Code:
model
class Get_model extends Model
        {
         function Get_model()
             {
             parent::Model();
             $this->load->database();
            
             }
            
          function get_locations()
             {
               $query = $this->db->select('location');
               $query = $this->db->select('record_id');
               $query = $this->db->from('inbook_important_phones');
               $query = $this->db->group_by('location');
                $query = $this->db->order_by('record_id');
               $query = $this->db->get('inbook_important_phones');
              
               return $query->result();
             }
            
         function get_locations_areas()
             {
               $query = $this->db->select('location');
               $query = $this->db->select('area');
               $query = $this->db->select('record_id');
               $query = $this->db->from('inbook_important_phones');
               $query = $this->db->group_by('area');
               $query = $this->db->get('inbook_important_phones');
              
               return $query->result();
             }    
            
         function get_areas_topics()
             {
               $query = $this->db->select('area');
                $query=$this->db->select('topics');
               $query = $this->db->select('record_id');
               $query = $this->db->from('inbook_important_phones');
               $query = $this->db->get('inbook_important_phones');
              
               return $query->result();
             }      
            
         function get_phone_number($location,$area,$topics)
             {
               $query    = $this->db->get_where('inbook_important_phones',array('location' => $location,'area' => $area,'topics' => $topics));
               $row=$query->row();
               $phone_number=$row->phone_number;      
               return $phone_number;
             }    
             }
Code:
Controller
    class important_phone_numbers extends Controller
        {
        
          function important_phone_numbers()
              {
             parent::Controller();
             $this->load->helper('url');
             $this->load->model('get_model');
             $data                  = array();
             }
            
          function index()
              {
               $data['location_data'] = $this->get_model->get_locations();
               $data['area_data']      = $this->get_model->get_locations_areas();
               $data['topic_data']      = $this->get_model->get_areas_topics();
               $this->load->view('view_imp_phone_details',$data);
             }          
    
          function search_result()
              {
               $data['location_data'] = $this->get_model->get_locations();
               $data['area_data']      = $this->get_model->get_locations_areas();
               $data['topic_data']      = $this->get_model->get_areas_topics();
              
               $location=$this->input->post('location');
               $area=$this->input->post('area');
               $topics=$this->input->post('topics');
               $data['phone_number']= $this->get_model->get_phone_number($location,$area,$topics);
              
               $data['location']=$location;
               $data['area']=$area;
               $data['topics']=$topics;
               $this->load->view('view_imp_phone_searh_result',$data); //
             }          
         }

check my view file in attachment..
#2

[eluser]erik.brannstrom[/eluser]
Instead of
Code:
function get_locations()
             {
               $query = $this->db->select('location');
               $query = $this->db->select('record_id');
               $query = $this->db->from('inbook_important_phones');
               $query = $this->db->group_by('location');
                $query = $this->db->order_by('record_id');
               $query = $this->db->get('inbook_important_phones');
              
               return $query->result();
             }
try
Code:
function get_locations()
             {
               $this->db->select('location, record_id');
               $this->db->group_by('location');
               $this->db->order_by('record_id');
               $query = $this->db->get('inbook_important_phones');
              
               return $query->result();
             }

Could be that multiple select method calls aren't allowed. And there is no point setting the query variable until you do a get call.
#3

[eluser]srajibtechno[/eluser]
thank you for your reply...
But i have another problem.




Theme © iAndrew 2016 - Forum software by © MyBB