Welcome Guest, Not a member yet? Register   Sign In
Help With Active Record Query
#1

[eluser]vbnullchar[/eluser]
how to do this in active record:

Code:
$email = [email protected];

$strQuery="select id, employee_id, email, dept_id, pos_id, comp_id, sup_id, alias
                from employees where FIND_IN_SET('$email',email)!=0";
#2

[eluser]pwninja[/eluser]
I could be wrong, but it's unlikely. FIND_IN_SET is a mysql only function. The whole point of active record is that it works across database platforms, so it can't use non-standard features such as this.
#3

[eluser]Armchair Samurai[/eluser]
Best guess:
Code:
$this->db->select('id, employee_id, email, dept_id, pos_id, comp_id, sup_id, alias');
$this->db->where("FIND_IN_SET('$email',email)!=", 0);
$query = $this->db->get('employees');
#4

[eluser]vbnullchar[/eluser]
Got it with the code below.. cheersss!

Code:
$employees = $this->load->database('employees',TRUE);
        
$employees->select('employees.id, employees.email, dept_heads.head_id, dept_heads.head_id2');
$employees->from('employees');
$employees->join('dept_heads', 'dept_head.id = employees.sup_id');
$employees->where('employees.email', $email);        
$employees->where("FIND_IN_SET('$email',employees.email) !=", 0);




Theme © iAndrew 2016 - Forum software by © MyBB