Coder missed a very simple fix and general good practice that you should always initialize your object before you try to set a property. It is very simple fix for this is simply to add a new StdClass; call right before the error with the variable it is trying to access.
CodeIgniter
<?php
//bad code
$this->db->insert('user', $this);
$userID=$this->db->insert_id();
$data->user_id = $userID;
$this->db->insert('user_profile', $data);
?>
<?php
//good code
$this->db->insert('user', $this);
$userID=$this->db->insert_id();
$data = new StdClass;
$data->user_id = $userID;
$this->db->insert('user_profile', $data);
?>
0 Comment(s)