• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI3 WHERE and ORDER_BY errors

#1
I have been looking into moving my one of my sites from CI2 to 3 and hit a snag that I have been unable to track down.  This code:

PHP Code:
$this->db->start_cache();
$this->db->select'molecule.idmolecule,molecule,comment, molecule.projects_id');
 $this->db->where'projects_id'$this->project_id );
$this->db->from'molecule' );
$this->db->order_by'molecule''ASC' );
       $query $this->db->get_compiled_select();
       print_r($query);
$this->db->flush_cache(); 

Returns this query which appears to me to be correct:
SELECT `molecule`.`idmolecule`, `molecule`, `comment`, `molecule`.`projects_id` FROM `molecule` WHERE `projects_id` = 7

If but it also returns this error even when I place a die; immediately after print:


A Database Error Occurred

Error Number: 1054
Unknown column 'projects_id' in 'where clause'

UPDATE `ci_sessions` SET `timestamp` = 1424579236 WHERE `projects_id` = 7 AND `id` = '51ae29260b86c80abe0c60829071d14727c66bdb'

Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 239

This is coming from both the WHERE and the ORDER_BY lines.  Removing both returns the data I expect.  That 'id' in the database error block is the session id.  Is this a bug or did I miss something???

Edit:
I did not have enough of the code pasted originally. I have traced the WHERE and ORDER_BY problem to having the start_cache and flush_cache lines.
Reply


Messages In This Thread
CI3 WHERE and ORDER_BY errors - by pkMyt1 - 02-21-2015, 09:52 PM
RE: CI3 WHERE and ORDER_BY errors - by Narf - 02-22-2015, 07:50 AM
RE: CI3 WHERE and ORDER_BY errors - by pkMyt1 - 02-22-2015, 08:07 AM
RE: CI3 WHERE and ORDER_BY errors - by pkMyt1 - 02-22-2015, 08:28 PM
RE: CI3 WHERE and ORDER_BY errors - by Narf - 02-23-2015, 07:28 AM
RE: CI3 WHERE and ORDER_BY errors - by pkMyt1 - 02-23-2015, 10:52 AM
RE: CI3 WHERE and ORDER_BY errors - by Narf - 02-23-2015, 12:26 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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