Welcome Guest, Not a member yet? Register   Sign In
Old way of using classes and CI's way - Confused
#1

(This post was last modified: 12-27-2018, 04:45 PM by dreamweaver.)

I have been trying to improve my code by sticking to OOP concepts. As you can see below my code is using a user class and passing that user class to the models class. 

In code igniter it would be done like this, but this isn't the case since it just gives me an error because of the parameters. 



PHP Code:
$this->load->library('User');
            $this->load->model('User_Model');

            $x = new User($params);
            $y = new User_Model($x);

            $y->insert(); 



My code below:




PHP Code:
$params = array('forename' => $_forename'surname' => $_surname'dob' => $_dob'address' => $_address'telephone' => $_telephone'email' => $_email'password' => $_password);
            
$user 
= new User($params);
            
$user_model 
= new User_Model($user);    

$user_model
->insert(); 
Reply


Messages In This Thread
Old way of using classes and CI's way - Confused - by dreamweaver - 12-27-2018, 04:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB