Problem with forgotten password

I am trying to build a form which must send new password to users who have forgotten them. I have build a Model and View but I have big problem with Controller. View consist of two input fields - one for email of the user and one for capcha. Here is the actionForgottenPass from the SiteController class:

I believe that the problem is in the ForgottenPassword::model()->updateAll or something connected with it. The error that i receive is:




CDbException

Description


CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@abv.bg LIMIT 1' at line 1



From the application.log I see that the query looks like this:




UPDATE `User` SET `password`=:yp0 WHERE 'emai'=test@test.test LIMIT 1



I will be very happy if someone help me.

test@test.test have to be in quotes like this

emai=‘test@test.test’ LIMIT 1

Btw, emai or email? ;)

And a better way is to bind params like this:




$c->condition='email=:email';

$c->params=array(':email'=>$forgotten->email);



I change the code as andy_s said and it works perfect now. Thank you a lot :)