0

severity: Warning Message: Creating default object from empty value Filename: controllers/person.php line Number: 133

   function update($id)
        {
            $responce = new StdClass;
            $this->_set_rules();
            $person = $this->Person_model->get_by_id($id)->row();

error in this line i  try to figure it ot
           $this->form_data->id = $id; 


            $this->form_data->name = $person->name;
            $this->form_data->gender = strtoupper($person->gender);
            $this->form_data->dob = date('d-m-Y',strtotime($person->dob));


            $data['title'] = 'Update person';
            $data['message'] = '';
            $data['action'] = site_url('person/updatePerson');
            $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

            // load view
            $this->load->view('personEdit', $data);
        }
3
  • Creating default object from empty value Commented Feb 11, 2015 at 14:17
  • If you like my answer please consider to "up-vote" Commented Feb 11, 2015 at 14:25
  • Where is form_data coming from? I see you are obtaining data from Person_model and saving the result row to variable $person...but I don't see where you are declaring form_data (at least within this function) Commented Feb 11, 2015 at 14:27

2 Answers 2

2

Lowercase "s" in stdClass:

$response = new stdClass;

NOT:

$responce = new StdClass;

Find out more on PHP objects here: http://php.net/manual/de/language.types.object.php

Sign up to request clarification or add additional context in comments.

1 Comment

Just a heads up. Response is spelled with a 's', not a 'c' (regardless if you are from the UK or USA). So the best answer would be $response = new StdClass;
0

You need to create the data object as shown below.

$responce = new stdClass();

Hope this will solve your error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.