I am working on a one page quick password reset module. I am asking username and email address on FULLTEXT field using a simple HTML form.
I want to be able to get these two fields from user on html form and compare it on mysql table and where ever these 2 fields viz Username and Email address matches I want to update the password field.
Please note that I am not using unique emails as usernames because of the design requirements. I am generating Username with PHP unique id with a bit of salting to get a capital letter username of 8 characters long.
For doing this i am setting a trigger before update query but but I am keep getting 2 different errors sometimes “Syntex error” and if I do a bit of modification to the query it becomes “Field Exits” error while it should mot because it is an update query.
$sql = "CREATE TRIGGER usr_pas before UPDATE ON tbl_uesrs
for each row
set NEW.usr_pas = (
(select `usr_email`,`usr_name`,`usr_pas`
from tbl_uesrs
where `usr_email` = $usremail and `usr_name` = $usernametomatch
),
NEW.usr_pas.$myhashnsaltnpepper)";
I tried creating this “trigger before update” but it errors into echoing Field Exist error.
I cannot seem to resolve this error as i have no idea whatsoever is wrong with this query.
i am giving complete components to this query.