Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <select name="list">
  2. <option value="mouse">mouse</option>
  3. <option value="keyboard">keyboard</option>
  4. <option value="headphones">headphones</option>
  5. </select>
  6.  
  7. $list = Yii::$app->request->post('list', 'mouse')
  8.  
  9. $result = Yii::$app->getDb()->createCommand('
  10. Select *
  11. from order_table
  12. where items_sort in :list
  13. ')->bindValue(':list', '('.$list.')')
  14. ->queryAll();
  15.  
  16. return $result;
  17. }
  18.  
  19. public function actionIndex()
  20. {
  21. $data = null;
  22. if(isset($_GET['last_month'])) {
  23.  
  24. $data = order::getTest();
  25. }
  26. $dataProvider = new ArrayDataProvider([
  27. 'allModels' => $data,
  28. 'sort' => [
  29. ],
  30. 'pagination' => [
  31. 'pageSize' => 50,
  32. ],
  33. ]);
  34.  
  35. return $this->render('index',['dataProvider' =>$dataProvider]);
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement