Get something or something and other from mysql

#1
[eluser]pisio[/eluser]
How I can fix it.
In user_passrecover I have form for submitting information for $step == 'nexstep'/
How I can run correctly mysql query ?
Code:
function forgotpassword()
    {

        $step =  $this->uri->segment(3);
       if($step == NULL)
       {
         $step = 1;
       }
       if($step == 'nextstep')
       {
             $this->db->get('user');
             $this->db->where(array('name'=>$_POST['name']));
             $this->db->or_where(array('name'=>$_POST['name'],'mail'=>$_POST['mail']));
             $this->db->query();

          $step = 2;

       }

       $this->load->view('user_passrecovery',array('step' => $step));
    }


}

#2
[eluser]Ben Edmunds[/eluser]
Maybe this is what you're looking for?

Code:
$query = $this->db->select('user')
                  ->where(array('name'=>$_POST['name']))
                  ->or_where(array('mail'=>$_POST['mail']))
                  ->get('users_table');

$user = $query->row();

Note that the chaining only works on php5...

#3
[eluser]pisio[/eluser]
[quote author="Ben Edmunds" date="1257745710"]Maybe this is what you're looking for?

Code:
$query = $this->db->select('user')
                  ->where(array('name'=>$_POST['name']))
                  ->or_where(array('mail'=>$_POST['mail']))
                  ->get('users_table');

$user = $query->row();

Note that the chaining only works on php5...[/quote]
I don't know this method. 10x Smile
One beer of me for you Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.