Welcome Guest, Not a member yet? Register   Sign In
run command in foreach loop or outside?
#1

[eluser]Gukkie[/eluser]
Hi i just got a question here. Which is the correct way to do this or are both right?

1:
Code:
foreach($data as $row)
    {
     $id       = $row['id'];
     $username = $row['username'];
     $email    = $row['email'];
    }
    
    $this->User_model->activate_account_model($id);
    redirect('home');

2:
Code:
foreach($data as $row)
    {
     $id       = $row['id'];
     $username = $row['username'];
     $email    = $row['email'];
     $this->User_model->activate_account_model($id);
     redirect('home');    
}

Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB