R
R
Ruslan Tilyaev2019-04-27 21:14:46
Yii
Ruslan Tilyaev, 2019-04-27 21:14:46

How to do search in yii2 website?

Hello, help me solve the problem. Each user has his own personal profile id. The site has a special page where you can find information about the user when you enter your profile id in the field. Id of the profile is given during registration (string of 10 digits). I've been trying to solve this problem all day

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Tilyaev, 2019-04-28
@Heckfy325

Thanks Dmitry .
public function actionIndex()
{
$q = Yii::$app->request->get('id_cart');
if ($q){
$query = Clients::find()->where('id_cart=:id', [':id' => $q])->one();
return $this->render('index', compact('query'));
}else{
Yii::$app->session->setFlash('error', 'Error... Please try again...');
return $this->refresh();
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question