Welcome Guest, Not a member yet? Register   Sign In
is it a normal Active Record bahaviour?
#1

[eluser]brazilius[/eluser]
This piece of code
Code:
$data=array(
            'email'    =>    $this->session->userdata( 'email' ),
        'password'    =>     $this->session->userdata( 'password' ),
        'active' => 1
        );
$this->db->get_where('users',$data);
echo $this->db->last_query();
if userdata for email and password wasn't set
both values would be FALSE
and query would be
SELECT * FROM (`users`) WHERE `email` = 0 AND `password` = 0 AND `active` = 1
and all rows with active = 1 are selected (i can't get why)

and if you use mysql_real_escape_string on both values from session
you get the right query
SELECT * FROM (`users`) WHERE `email` = '' AND `password` = '' AND `active` = 1

is it a right behaviour or a bug&


Messages In This Thread
is it a normal Active Record bahaviour? - by El Forum - 10-16-2008, 07:51 PM
is it a normal Active Record bahaviour? - by El Forum - 10-17-2008, 12:46 AM
is it a normal Active Record bahaviour? - by El Forum - 10-17-2008, 12:48 AM
is it a normal Active Record bahaviour? - by El Forum - 10-17-2008, 01:15 AM
is it a normal Active Record bahaviour? - by El Forum - 10-17-2008, 01:18 AM
is it a normal Active Record bahaviour? - by El Forum - 10-17-2008, 01:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB