Welcome Guest, Not a member yet? Register   Sign In
add a function in where using AR
#1

[eluser]mmiranda[/eluser]
Hi, i want to run this query:

select id from user where username = '$user' and password = sha('$password')

i tried :

$query = $this->db->select('id')
->get_where('user', array('username' => $username,
'password' => SHA('$password')
,1);

but it not working...
what i am doin wrong?
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="mmiranda" date="1245893459"]Hi, i want to run this query:

select id from user where username = '$user' and password = sha('$password')

i tried :
Code:
$query = $this->db->select('id')
                          ->get_where('user', array('username' => $username,
                                                    'password' => SHA('$password')
                                                    ,1);

but it not working...
what i am doin wrong?[/quote]

Code:
$query = $this->db->select('id')
                          ->get_where('user', array('username' => $username,
                                                    'password' => [b]SHA1[/b]('$password')
                                                    ,1);

did you mean sha1()? did you check what sql statement it produced?
#3

[eluser]mmiranda[/eluser]
well, sha is synonymous with SHA1().

i didnt check the sql, i dont know how to do it...
#4

[eluser]Thorpe Obazee[/eluser]
[quote author="mmiranda" date="1245909924"]well, sha is synonymous with SHA1().

i didnt check the sql, i dont know how to do it...[/quote]

I didn't know what and it gives me errors:

Quote:Fatal error: Call to undefined function: sha()

Anyway, use the profiler class and you'll see the generated sql statements.




Theme © iAndrew 2016 - Forum software by © MyBB