To check a record exist on table use below code,
$exist = User::find()->where(['email' => $email])->exists();
if($exist)
echo 'Exist.';
else
echo 'Not exist.';
$exist = User::find()->where(['email' => $email])->exists();
if($exist)
echo 'Exist.';
else
echo 'Not exist.';
No comments:
Post a Comment