EllisLab text mark
Advanced Search
     
use_table() bug
Posted: 03 October 2007 02:12 PM   [ Ignore ]
Joined: 2005-12-28
13 posts

I finally found the bug that was causing CI to give me strange looking queries when using the active record class. Some time ago, the use_table() function was deprecated. The code to ‘not to break’ older apps is faulty.

function use_table($table)
{
    
return $this->from($table);
    return 
$this;

What happens is that when a model or somewhere else in your app, uses this function, ci forgets to reset the var. so older , aldready set vars are being used to generate a new query. This gives strange results indeed !

the use_table() function puts it’s var into the ar_from() array and this does not get reset

Solution…... remove all code that uses these function… it cause your app to break.