• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a problem with get_where

this code
$query = $this->db->get_where('mem_sys_views', array('mode' => $mode,
'action' => $action));

Gives me this
Error Number: 1054

Unknown column 'form_id' in 'where clause'

SELECT * FROM (`mem_sys_views`) WHERE `form_id` = 'bfcebbbd76ff508773d7a974e308bae5' AND `mode` = 'member' AND `action` = 'edit'
Note form_id is not in the 'where' array

I'm guessing (at the moment)it comes from a previous call to where() or get_where()
Do I somehow need to 'clear' the where clause before creating another

I'm on the latest version of CI

best wishe Ed

do you use the cache methods somewhere? If that is the case you have to use flush_cache() after you are done with the cached statement parts.

all active record methods should be calling _reset_select on their own so this shouldn't be something you ever run in to.

Do me a favour.

a)right before query look at the last query executed.
echo $this->db->last_query();
$query = $this->db->get_where(’mem_sys_views’, array(’mode’ => $mode, ‘action’ => $action));

If you see `form_id` = ‘bfcebbbd76ff508773d7a974e308bae5’ anywhere in that query then something is wrong with active record and will need some debugging.

If it's not in your last query then somewhere you've set a $this->db->where('form_id',$val); without ever executing the query and that is most likely your problem.

nice one. In an earlier function I made an update to another table and then added the where clause. :ahhh: . it was subsequently never used


[eluser]Code Arachn!d[/eluser]
I'm having this same issue - I've double checked the code and can with certainty say that there is a weird bug happening with the query. What's weird is that on my development server it works as expected but on the production server (all code is identical) it throws the error:
Error Number: 1054
Unknown column 'invoice_type' in 'where clause'
I'm not sure if it's the version of MySQL since that is the only difference between the two systems. This is the code for the AR query:
$this->db->where('invoice_type', '107');
$this->db->where('invoice_status', '0');
$this->db->where('invoice_status_datetime IS NOT NULL');
$this->db->where('invoice_exported IS NULL');
$query = $this->db->get();
If I comment out the first where statement it will work perfectly fine.

Also I should note on this site I'm still using version 1.5 (I haven't noticed this problem with 1.6 yet like mentioned above)

If you have multiple queries and you are worried about their results running together, try this:


From the userguide: http://ellislab.com/codeigniter/user-gui...sults.html

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.