title: website developed with codeigniter working well on localhost but internal server error 500 on live server
body: <p>I am newbie to codeigniter i am developed a website from past few days. The website working well on the localhost.but when i tested that that website on live web server i gives out following error:</p>
  
  <p>500 - Internal server error.
      There is a problem with the resource you are looking for, and it cannot be displayed.
       i tried a lot of things like .htaccess solutions available on different tutorials but not successful. Then i tried my self debugging and found that when i comment out the model loading line my index page get loaded without that data to have to get from the db.But as soon as i remove comment from that line it again gives me the same error. Then i checked my model i wont find any such problem.Now i am not using any .htaccess.
      PHP version on server:5.2.17
      codeigniter version:CodeIgniter_2.1.4</p>
  
  <p>------------------------My code for controller is---------------------------------</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?&gt;
      &lt;?php 
  
      class video extends CI_Controller
      {
      function __construct()
          {
              parent::__construct();
              $this-&gt;load-&gt;helper('url');
              $this-&gt;load-&gt;model('video_model');
              $this-&gt;load-&gt;helper('html');
              $this-&gt;load-&gt;library('session');
          }
      function index()
      {
          $this-&gt;session-&gt;unset_userdata('searchterm');
          $data['latest_video']=$this-&gt;latest_video();
          $data['uk_video']=$this-&gt;uk_video();
          $data['hm_video']=$this-&gt;hm_video();
          $this-&gt;load-&gt;view('index',$data);
      }
      function watch()
      {
          $v_type=$this-&gt;uri-&gt;segment(3);
          $v_id=$this-&gt;uri-&gt;segment(4);
          if($v_type &amp;&amp; $v_id)
          {
          $data['multiple_videos']=$this-&gt;video_model-&gt;get_all_videos($v_type);
          $data['single_video']=$this-&gt;video_model-&gt;get_single_video($v_id,$v_type);
          $counter= $data['single_video'][0]['counter'];
          $id= $data['single_video'][0]['v_id'];
          $this-&gt;load-&gt;view('watch',$data);
          $this-&gt;view_counter($id,$counter);
          }
          else
          {
              redirect('video','refresh');
          }
      }
      function latest_video()
      {
      $data[]=$this-&gt;video_model-&gt;get_latest_video();
      return $data;
  
      }
      function uk_video()
      {
      $data[]=$this-&gt;video_model-&gt;get_uttrakhand_video();
      return $data;
  
      }
      function hm_video()
      {
      $data[]=$this-&gt;video_model-&gt;get_himachal_video();
      return $data;
  
      }
      function result()
      {
          $this-&gt;load-&gt;view('search');
      }
      function view_counter($id,$counter)
      {
  
          $user_ip=$this-&gt;input-&gt;ip_address();
          if(!$this-&gt;input-&gt;cookie($id))
          {
              $cookie=array('name'=&gt;$id,'value'=&gt;$user_ip,'expire'=&gt;43200);
              $this-&gt;input-&gt;set_cookie($cookie);
              $counter++;
  
          }
          if($this-&gt;input-&gt;cookie($id))
          {
              if($this-&gt;input-&gt;cookie($id,TRUE)!=$user_ip)
              {
                  $counter=+$counter;
              }
          }
  
          $update=array('counter'=&gt;$counter);
          $this-&gt;db-&gt;where('v_id',$id);
          $this-&gt;db-&gt;update('tblvideo',$update);
      }
  
      }
      ?&gt;
  </code></pre>
  
  <p>------------------------My code for Model is---------------------------------</p>
  
  <pre><code>&lt;?php class video_model extends CI_Model
  {
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;database();
      }
  
      function get_latest_video()
  
      {
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;order_by('v_time','DESC')-&gt;limit(3);
          $query=$this-&gt;db-&gt;get();
          return $latest_data=$query-&gt;result_array();
      }
      function get_uttrakhand_video()
  
      {
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;where('v_type','uk')-&gt;order_by('v_time','DESC')-&gt;limit(4,3);
          $query=$this-&gt;db-&gt;get();
          return $latest_data=$query-&gt;result_array();
      }
      function get_himachal_video()
  
      {
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;where('v_type','hm')-&gt;order_by('v_time','DESC')-&gt;limit(4,3);
          $query=$this-&gt;db-&gt;get();
          return $latest_data=$query-&gt;result_array();
      }
      function insert_data()
      {
          $data=array(
  
              'v_title'=&gt;$this-&gt;input-&gt;post('v_title'),
              'v_name'=&gt;$this-&gt;input-&gt;post('v_name'),
              'v_description'=&gt;$this-&gt;input-&gt;post('v_description'),
              'v_tags'=&gt;$this-&gt;input-&gt;post('v_tags'),
              'v_duration'=&gt;$this-&gt;input-&gt;post('v_duration'),
              'v_type'=&gt;$this-&gt;input-&gt;post('v_type')
          );
          return $this-&gt;db-&gt;insert('tblvideo',$data);
          echo "data inserted";
      }
      function get_single_video($v_id,$v_type)
      {
          $cond=array('v_id'=&gt;$v_id,'v_type'=&gt;$v_type);
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;where($cond);
          $res=$this-&gt;db-&gt;get();
          return $res-&gt;result_array();
      }
      function get_all_videos($v_type)
      {
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;where('v_type',$v_type)-&gt;order_by('v_time','DESC')-&gt;limit(30);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
  
      }
      function get_video_list($limit,$offset)
      {
          $offset=intval($offset);
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_tags,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;order_by('v_time','DESC')-&gt;limit($limit,$offset);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
  
      }
      function get_total_number_videos()
      {
      $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_tags,v_image,v_type,v_duration,v_time,counter')-&gt;from('tblvideo')-&gt;order_by('v_time','DESC');
      $query=$this-&gt;db-&gt;get();
      return $query-&gt;num_rows();
  
      }
      function video_edit($v_id)
      {
          $this-&gt;db-&gt;select('v_id,v_name,v_title,v_description,v_image,v_tags,v_type,v_duration,v_time')-&gt;from('tblvideo')-&gt;where('v_id',$v_id);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
  
      }
      function video_update($id,$table,$form_data)
      {
          $this-&gt;db-&gt;where('v_id',$id);
          return $response=$this-&gt;db-&gt;update($table,$form_data);  
      }
      function delete($id,$table)
      {
          $this-&gt;db-&gt;delete($table, array('v_id' =&gt; $id)); 
      }
      function user_authentication($u_name,$pwd)
      {
          $array=array('username'=&gt;$u_name,'password'=&gt;$pwd,'type'=&gt;'admin');
          $this-&gt;db-&gt;select('username,password,id,type')-&gt;from('tblusers')-&gt;where($array);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;num_rows();
      }
      function user_data($u_name,$pwd)
      {
          $array=array('username'=&gt;$u_name,'password'=&gt;$pwd,'type'=&gt;'admin');
          $this-&gt;db-&gt;select('username,password,id,type')-&gt;from('tblusers')-&gt;where($array);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
      }
  
  }?&gt;
  
  
  
  
    please take look at the problem thank you...
  </code></pre>