I am new to zend. I am trying to create login form using zend framework. But its creating problem. Below is my function
public function loginAction()
{
$db = $this->_getParam('db');
$form = new Application_Form_Login();
$this->view->form = $form;
if($this->getRequest()->isPost())
{
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData))
{
$adapter = new Zend_Auth_Adapter_DbTable(
$db,
'users',
'emailaddress',
'password',
'MD5(CONCAT(?, password_salt))'
);
$adapter->setIdentity($form->getValue('email'));
$adapter->setCredential($form->getValue('password'));
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$this->_helper->FlashMessenger('Successful Login');
$this->_redirect('/');
return;
}
}
}
}
its giving error on following line -> $result = $auth->authenticate($adapter);
Error is -> Message: The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity.
my table name is 'users' and it has columns(id,firstname,lastname,age,emailaddress,password).