codeigniter - PHP Message: Undefined property: Update_form::$update_model -


please me on error:

a php error encountered

severity: notice  message: undefined property: update_form::$update_model  filename: controllers/update_form.php  line number: 15  backtrace:  file: c:\xampp\htdocs\306\application\controllers\update_form.php line: 15 function: _error_handler  file: c:\xampp\htdocs\306\index.php line: 315 function: require_once 

an uncaught exception encountered

type: error  message: call member function rest() on null  filename: c:\xampp\htdocs\306\application\controllers\update_form.php  line number: 15  backtrace:  file: c:\xampp\htdocs\306\index.php line: 315 function: require_once 

here code:

update.php

<?php class update extends ci_controller {     function __construct()     {         parent::__construct();         $this->load->helper(array('html','form','url'));         $this->load->library('table');         $this->load->model('update_model');     }     function index()     {         $this->table->set_heading('books name','author','edit records');          $tstyle= array(                  'table_open' => '<table border="1" align="center" cellpadding="4" cellspacing ="0">'             );         $this->table->set_template($tstyle);          $answer = $this->update_model->select();                  foreach ($answer $row)                 {                     $link = anchor(base_url().'update_form/update_function/'.$row->id,'edit');                     $this->table->add_row($row->name,$row->author,$link);                 }                 echo $this->table->generate();     } }?> 

update_model.php

<?php  /** *  */ class update_model extends ci_model {      function __construct()     {         parent::__construct();     }      function select()     {         $this->db->select();         $this->db->from('books');          $query = $this->db->get();          return $query->result();     }       function rest($id)     {         $this->db->select();         $this->db->from('books');         $this->db->where('id',$id);          $query1= $this->db->get();         if($query1->num_rows() ==1)         {             return $query1->result();          }     } }?> 

update_form.php

<?php  class update_form extends ci_controller {     function ___construct()     {         parent::__construct();         $this->load->helper('form');         $this->load->model('update_model');      }      function update_function($id)     {         $answer = $this->update_model->rest($id);              foreach ($answer $row)              {                 echo form_open();                 echo form_label('book','book');                 echo form_input('book', $row->name);                  echo form_label('author','author');                 echo form_input('author', $row->author);                  echo form_submit('submit','update');                 echo form_close();               }      }  }?> 

you need check line line code add below controller :

add below line on top of page of controller

 if ( ! defined('basepath')) exit('no direct script access allowed'); 

**check controller class name uppercase first letter. **

$this->load->model('update_model'); 

now update_model.php

add : $this->db->select('*')

try load model on method or can try check autoload.php files..

it showing line no 15 on update_form.php : create function public in controller.

check or mark accepted if works


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -