Welcome Guest, Not a member yet? Register   Sign In
mysql forbidden field name in WHERE clause ?
#1

[eluser]symbol.software[/eluser]
Hello CI community,

I just moved to CI and now I'm working to my own user_model class.

I'm trying to query the users table but here is what happens:

When the column name is 'username' the this field is erased from my query!
When I rename the column name to 'userid' or 'uname' or anything else it works fine.

Is this a security protection, how do I avoid this ?

Here is my code:
Code:
$query = $this->db->get_where($this->user_table, array('username'=>$username, 'password'=>$password));
The result of this query is:
Code:
SELECT * FROM (`users`) WHERE ` = 'jhon365' AND `password` = 'mypassword'

Here is the code that works

Code:
$query = $this->db->get_where($this->user_table, array('uname'=>$username, 'password'=>$password));

The result of this query is:
Code:
SELECT * FROM (`users`) WHERE `uname` = 'jhon365' AND `password` = 'mypassword'

It is obvious that active record class is simply erasing the word 'username' from my code.
How do I solve this ? I really like to have my field named 'username'.


Thank you so much!

Michael


Messages In This Thread
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 07:07 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 08:07 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 08:26 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 09:07 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 09:08 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 09:31 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 11:10 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 11:16 AM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 12:13 PM
mysql forbidden field name in WHERE clause ? - by El Forum - 09-18-2009, 12:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB