ion_auth messing up my query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7) +--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13) +--- Thread: ion_auth messing up my query (/showthread.php?tid=68275) |
ion_auth messing up my query - frocco - 06-18-2017 Hello, Code: $user = $this->ion_auth->user()->row(); Unknown column 'appt_date' in 'where clause' SELECT `users_groups`.`group_id` as `id`, `groups`.`name`, `groups`.`description` FROM `users_groups` JOIN `groups` ON `users_groups`.`group_id`=`groups`.`id` WHERE `appt_date` >= '2017-06-12' AND `appt_date` <= '2017-06-12' AND `users_groups`.`user_id` = '1' Above fails because query is trying to select query based on ion_table RE: ion_auth messing up my query - PaulD - 06-18-2017 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(); Best wishes, Paul. RE: ion_auth messing up my query - frocco - 06-19-2017 Thank you Paul. I will try this today. |