I am using codeigniter for my application and i am a bit confused, I wrote some queries like that:
public function checkemail($email) {
$this->db->select('email')->from('user')->where('email', $email);
}
But in the manual of codeigniter ( http://codeigniter.com/user_guide/database/active_record.html ) they talk about $this->db->get();
Should I add it after the $this->db->select query?
My function works fine…
When should I use get() ?
Thanks you!
Yes, you’ll need to run
get()after the other methods.select(),from()andwhere()add their respective statements to the query, and get() actually runs the query and returns the result as an object.In this case, you could just add it on to the end of the chain.
If you want to work with the result afterwards, make sure that you are assigning it to a variable.