title: CRUD Operations using codeigniter
body: <p>I have done this CRUD operations in CODEIGNITER. But when i try to run the program, I am getting a blank page. And I'm not able to know what the errors are. Any help would be appreciated. I have attached the code below.</p>
  
  <p>Stud_controller.php
  `     </p>
  
  <pre><code>  &lt;?php
    defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Stud_controller extends CI_Controller {
  
  function __construct(){
  
      parent:: __construct();
      $this-&gt;load-&gt;helper('url');
      $this-&gt;load-&gt;database();
  }
  
  public function index()
  {
      $query = $this-&gt;db-&gt;get('stud');
      $data['records'] = $query-&gt;result();
  
      $this-&gt;load-&gt;helper('url');
      $this-&gt;load-&gt;view('Stud_view', $data);
  }
  
  public function add_student_view(){
      $this-&gt;load-&gt;helper('form');
      $this-&gt;load-&gt;view('Stud_add');
  }
  
  public function add_student(){
  
      $this-&gt;load-&gt;model('Stud_Model');
  
      $data = array(
          'Roll_No' =&gt; $this-&gt;input-&gt;post('Roll_No'),
          'Name' =&gt; $this-&gt;input-&gt;post('Name')
      );
  
      $this-&gt;Stud_Model-&gt;insert($data);
  
      $query = $this-&gt;db-&gt;get("stud");
      $data['records'] = $query-&gt;result();
      $this-&gt;load-&gt;view('Stud_view',$data);
  
  }
  
  public function update_student(){
  
      $this-&gt;load-&gt;model('Stud_Model');
  
      $data = array(
  
          'Roll_No' =&gt; $this-&gt;input-&gt;post('Roll_No'),
          'Name' =&gt; $this-&gt;input-&gt;post('Name')
      );
  
      $old_Roll_No = $this-&gt;input-&gt;post('old_Roll_No');
      $this-&gt;Stud_Model-&gt;update($data,$old_Roll_No);
  
      $query = $this-&gt;db-&gt;get("stud");
      $data['records'] = $query-&gt;result();
      $this-&gt;load-&gt;view('Stud_view',$data);
  }
  
  public function delete_student(){
  
      $this-&gt;load-&gt;model('Stud_Model');
      $Roll_No = $this-&gt;uri-&gt;segment('3');
      $this-&gt;Stud_Model-&gt;delete($Roll_No);
  
      $query = $this-&gt;db-&gt;get("stud");
      $data['records'] = $query-&gt;result();
      $this-&gt;load-view('Stud_view',$data);
    }
   }
  ?&gt;`
  </code></pre>
  
  <p>Stud_Model.php</p>
  
  <pre><code>&lt;?php
  
  Class Stud_Model extends CI_Model {
  
      function __construct(){
          parent:: __construct();
      }
  
      public function insert($data) {
          if($this-&gt;db-&gt;insert("stud", $data)){
              return true;
          }
      }
  
      public function delete($Roll_No){
          if($this-&gt;db-&gt;delete("stud", "Roll_No = " .$Roll_No)){
              return true;
          }
      }
  
      public function update($data,$old_Roll_No){
          $this-&gt;db-&gt;set($data);
          $this-&gt;db-&gt;where("Roll_No", $old_Roll_No);
          $this-&gt;db-&gt;update("stud", $data);
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>Stud_view.php</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Student&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;a href = '&lt;?php echo base_url(); ?&gt;
  index.php/stud/add_view"&gt;Add&lt;/a&gt;
  
  &lt;table border = "1"&gt;
  &lt;?php
      $i = 1;
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;Sr#&lt;/td&gt;";
      echo "&lt;td&gt;Roll No.&lt;/td&gt;";
      echo "&lt;td&gt;Name&lt;/td&gt;";
      echo "&lt;td&gt;Edit&lt;/td&gt;";
      echo "&lt;td&gt;Delete&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  
      foreach($records as $r){
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;".$i++."&lt;/td&gt;";
          echo "&lt;td&gt;".$r-&gt;Roll_No."&lt;/td&gt;";
          echo "&lt;td&gt;".$r-&gt;Name."&lt;/td&gt;";
          echo "&lt;td&gt;&lt;a href = '".base_url()."index.php/stud/edit/"
                .$r-&gt;Roll_No."'&gt;Edit&lt;/a&gt;&lt;/td&gt;"; 
          echo "&lt;td&gt;&lt;a href = '".base_url()."index.php/stud/delete/"
                .$r-&gt;Roll_No."'&gt;Delete&lt;/a&gt;&lt;/td&gt;"; 
          echo "&lt;tr&gt;"; 
  
      }
      ?&gt;
      &lt;/table&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>