CodeIgniter Forums
very newbie question - 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: very newbie question (/showthread.php?tid=6547)



very newbie question - El Forum - 03-03-2008

[eluser]Unknown[/eluser]
hey,
im new to php and codeigniter and i want to create something with ci.
here is my question, how can i create like this query

Code:
SELECT username,password FROM users WHERE username=$foo AND password=$bar

with codeigniter activerecord ? like this ?

Code:
$this->db->select('username,password');
$this->db->from('users');
$this->db->where('username', $foo);
$this->db->where('password', $bar);
$query = $this->db->get();

thanx form help.


very newbie question - El Forum - 03-03-2008

[eluser]louis w[/eluser]
Looks right to me. What happens?


very newbie question - El Forum - 03-03-2008

[eluser]pickledegg2[/eluser]
looks right to me too.


very newbie question - El Forum - 03-03-2008

[eluser]exodus7[/eluser]
you can also turn on the profiler by typing
Code:
$this->output->enable_profiler(TRUE);
which will allow you to view the queries that were generated.


very newbie question - El Forum - 03-06-2008

[eluser]pickledegg2[/eluser]
Quote:$this->output->enable_profiler(TRUE);
Every days a schoolday, thanks for the tip Wink