CodeIgniter Forums
$this->db->get_where OR Same thing. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: $this->db->get_where OR Same thing. (/showthread.php?tid=24225)



$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]pisio[/eluser]
Hi all Smile
How i can run SQL :
Quote:SELECT * FROM `users` WHERE `name` = $name OR `mail` $mail

Code:
$smasiv =  array('name' => $p['name'],'mail' => $p['mail']);
$query = $this->db->get_where('user',$smasiv );



$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]pistolPete[/eluser]
Please use [ code ] tags!

Read the user guide: http://ellislab.com/codeigniter/user-guide/database/active_record.html#select

Code:
$this->db->where('name', $p['name']);
$this->db->or_where('mail', $p['mail']);
$query = $this->db->get('user');



$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]BrianDHall[/eluser]
Code:
$query = $this->db->where('user', $smasiv)->or_where('mail', $mail)->get('user');

Edit: PistolPete beat me to it Wink


$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]praveens[/eluser]
try this

Code:
$this->db->where('name =', $name);
$this->db->or_where('mail =', $mail);
$query = $this->db->get('users');



$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]pisio[/eluser]
10x to all Smile



These Framework is very cool and have best support Smile


$this->db->get_where OR Same thing. - El Forum - 11-03-2009

[eluser]marjune[/eluser]
Code:
$this->db->query("SELECT * FROM `users`  WHERE `name` =  $name OR `mail`= $mail");