Welcome Guest, Not a member yet? Register   Sign In
MySQL Query using ?deprecated? syntax
#2

[eluser]steelaz[/eluser]
Is there a reason why you don't want to join firstname and lastname strings after you get them from database (below)?

Code:
public function addToUserId($email, $new_to_user_id)
{
     $this->db->select('firstname', 'lastname');
     $this->db->from('fa_user');
     $this->db->from('user');
     $this->db->where('fa_user_id = id');
     $this->db->where('user_id', $new_to_user_id);
     $results = $this->db->get()->result();

     $email_to = $email->getTo();
     $email_to[] = $results[0]->firstname .'.'. $results[0]->lastname;
}

Also, if you're expecting just one result, instead of using result(), you can use row():

Code:
public function addToUserId($email, $new_to_user_id)
{
     $this->db->select('firstname', 'lastname');
     $this->db->from('fa_user');
     $this->db->from('user');
     $this->db->where('fa_user_id = id');
     $this->db->where('user_id', $new_to_user_id);
     $result = $this->db->get()->row();

     $email_to = $email->getTo();
     $email_to[] = $result->firstname .'.'. $result->lastname;
}


Messages In This Thread
MySQL Query using ?deprecated? syntax - by El Forum - 08-22-2009, 06:55 AM
MySQL Query using ?deprecated? syntax - by El Forum - 08-22-2009, 10:47 AM
MySQL Query using ?deprecated? syntax - by El Forum - 08-22-2009, 12:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB