Q:

Remove row index from query result of codeigniter

i'm new in codeigniter, and i have a little problem (not really a problem) getting results from query.
Use this code as example:
$query = $this->db->query("SELECT u_id FROM users WHERE u_email={$email} AND u_password=PASSWORD({$password}) ;");
print_r($query->result());

It returns:
Array
(
    [0] => stdClass Object
        (
            [u_id] => 1
        )
)

Can i remove the row index? Fetching results using something similar next code is horrible:
foreach( as $info){
    print_r($info);
}

Thanks!

A:

If you know your query will return only one row then use the appropriate CI function to get just one row, then it will not return the result into an array.
$query = $this->db->query("SELECT u_id FROM users WHERE u_email={$email} AND u_password=PASSWORD({$password}) ;");

$row = $query->row();

echo $row->u_id;

