CodeIgniter Forums
Get something or something and other from mysql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Get something or something and other from mysql (/thread-24370.html)



Get something or something and other from mysql - El Forum - 11-08-2009

[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));
    }


}



Get something or something and other from mysql - El Forum - 11-08-2009

[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...


Get something or something and other from mysql - El Forum - 11-08-2009

[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