Welcome Guest, Not a member yet? Register   Sign In
use_table() bug
#1

[eluser]starbbs[/eluser]
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.

Code:
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.




Theme © iAndrew 2016 - Forum software by © MyBB