Hi
I have a form where
-
I take user email input , user clicks button
-
/Ajax/ Check if user already exists in database
I am able to Ajax post the email address to controller but I do not know how to search the database(names User with email, username , pwd columns).
[b]
FIREBUG Error
CException
Property "CDbCriteria.email" is not defined. (C:\xampp\htdocs\yii\framework\base\CComponent.php:174)[/b]
Please help.
[b]Controller Code
[/b]
public function actionField()
{
//$model2 = new User();
if(isset($_POST['index']))
{
[b]$model2=User::model()->findAll(array('email' => $_POST['index']));
if ($model2===NULL)
{
$this->renderPartial('_task', array('model' => $model2));[/b]
}
}
}
FIREBUG ERROR
[b]<h1>CException</h1>
<p>Property “CDbCriteria.email” is not defined. (C:\xampp\htdocs\yii\framework\base\CComponent.php:174)</p><pre>#0 C:\xampp\htdocs\yii\framework\db\schema\CDbCriteria.php(153): CComponent->__set(‘email’, ‘vikas02121@yaho…’)
#1 C:\xampp\htdocs\yii\framework\db\schema\CDbCommandBuilder.php(460): CDbCriteria->__construct(Array)
#2 C:\xampp\htdocs\yii\framework\db\ar\CActiveRecord.php(1409): CDbCommandBuilder->createCriteria(Array, Array)
#3 C:\xampp\htdocs\mylls1\protected\controllers\homeController.php(71): CActiveRecord->findAll(Array)
#4 C:\xampp\htdocs\yii\framework\web\actions\CInlineAction.php(50): HomeController->actionField()
#5 C:\xampp\htdocs\yii\framework\web\CController.php(300): CInlineAction->runWithParams(Array)
#6 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(134): CController->runAction(Object(CInlineAction))
#7 C:\xampp\htdocs\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()
#8 C:\xampp\htdocs\yii\framework\web\CController.php(1144): CFilter->filter(Object(CFilterChain))
#9 C:\xampp\htdocs\yii\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#10 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(Object(CFilterChain))
#11 C:\xampp\htdocs\yii\framework\web\CController.php(283): CFilterChain->run()
#12 C:\xampp\htdocs\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#13 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(277): CController->run(‘field’)
#14 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(136): CWebApplication->runController(‘home/field’)
#15 C:\xampp\htdocs\yii\framework\base\CApplication.php(158): CWebApplication->processRequest()
#16 C:\xampp\htdocs\mylls1\index.php(13): CApplication->run()
#17 {main}</pre>[/b]