CodeIgniter Forums
DB Active record bug in CI 1.7.x - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DB Active record bug in CI 1.7.x (/showthread.php?tid=15886)



DB Active record bug in CI 1.7.x - El Forum - 02-17-2009

[eluser]KeyStroke[/eluser]
Hi,

After upgrading the database files in CI to 1.7.x, I've noticed that, when using active records, and when I don't add spaces around the equal sign in the "where" clause like this:
Code:
$this->db->select('*')->from('user,city')->where('user.city_id=city.id')->get();

I get the following error:
Quote: A Database Error Occurred

Error Number: 1054

Unknown column ‘user.city_id=city.id’ in ‘where clause’

SELECT * FROM (`user`, `city`) WHERE `user`.`city_id=city`.`id`
A workaround has been posted within this thread:
http://ellislab.com/forums/viewthread/106056/P15/#533910