I have these codes on my controller that gets the inputted value to the text box by the user:
$username = $this->request->data['employee_account']['username'];
$password = $this->request->data['employee_account']['password'];
I want this kind of query to be implemented using cakePHP code:
"SELECT * FROM accounts WHERE username = '$username' AND password = '$password'";
how can i do this using find()??
Assuming you have model with name accounts
$login = $this->Account->find('first', array(
'conditions' => array(
'Account.email' => $username,
'Account.password' => $password
)
));
if ($login)
{//do something}
else
{
}