Welcome Guest, Not a member yet? Register   Sign In
multiple models (one for each row)
#1

[eluser]Sweden[/eluser]
Hello!

I have a problem where I would like each model to represent a row in the table, so that a user example can be loaded like this:
Code:
$this->load->model("User_model", "User");
$this->User->GetFromID(1);
echo $this->name;

This works fine, however now I want to get say 10 users from the table and for each row I wanna create a user object. What is the easiest way to do this?

What I've been using prevously looks like this:
Code:
while($row = $sth->fetch(PDO::FETCH_ASSOC)) {
//fetch object instead?
}

Not sure if thats any helpful, let me know if there is something not clear




Theme © iAndrew 2016 - Forum software by © MyBB