Codeigniter CRUD app error: trying to get property of non-object - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Codeigniter CRUD app error: trying to get property of non-object (/showthread.php?tid=68762) |
Codeigniter CRUD app error: trying to get property of non-object - Ajax30 - 08-22-2017 I have put together a CRUD application with Codeigniter 3. The update form has data validation set up, through the controller: UPDATE function: Code: public function update($customer_id) { It does go through the if, but not through the else. UPDATE form: Code: <?php echo form_open("home/update/{$customer->id}"); ?> The UPDATE model is: Code: public function getAllCustomers($customer_id) { The UPDATE view: Code: <?php echo form_open("home/update/{$customer->id}"); ?> There is this problem with editing a record, inputting invalid data, then hitting the "Save button": Code: Severity: Notice Such a problem appears only on the update form. What could be the cause of this? Thank you! RE: Codeigniter CRUD app error: trying to get property of non-object - donpwinston - 08-22-2017 <?php echo form_open("home/update/{$customer->id}"); ?> There's no customer object. Looks like you're using an array, so use $customer['id'] RE: Codeigniter CRUD app error: trying to get property of non-object - Ajax30 - 08-22-2017 (08-22-2017, 12:36 PM)donpwinston Wrote: <?php echo form_open("home/update/{$customer->id}"); ?> As I have written above, it does go through the if, but not the else. So there can not be a problem with $customer->id. RE: Codeigniter CRUD app error: trying to get property of non-object - InsiteFX - 08-24-2017 If you read the documentation it shows the example like below: PHP Code: if ($this->form_validation->run() == FALSE) |