Welcome Guest, Not a member yet? Register   Sign In
ion_auth messing up my query
#2

If that is the case you can use

PHP Code:
$this->db->reset_query(); 

To clear all the settings before starting to use the query builder. This will fix the issue but not the cause of the issue.

Actually re-reading your issue, it is the call to ion_auth inside your query builder clauses. If ion_auth runs a query now you will lose your original db lines in your query as they will get reset.

Perhaps you should try getting your user group variable out before creating your db query. Something like:

PHP Code:
$user $this->ion_auth->user()->row();

$check_department = ($this->ion_auth->in_group('Requester')) ? TRUE FALSE;

$this->db->where('appt_date >='$FromAppt_Date);
$this->db->where('appt_date<='$ToAppt_Date);
if (
$check_department$this->db->where('department_code'$user->department_code);
$query $this->db->get('table'); 

Best wishes,

Paul.
Reply


Messages In This Thread
ion_auth messing up my query - by frocco - 06-18-2017, 11:28 AM
RE: ion_auth messing up my query - by PaulD - 06-18-2017, 12:25 PM
RE: ion_auth messing up my query - by frocco - 06-19-2017, 02:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB