thinkHow to use the search function in PHP3.2.3? What is wrong with the following
public function index(){
$article=D('article');
$keyboard=isset($_GET['keyboard'])?$_GET ['keyboard']:'';
$where=[]; //Search conditions
if($keyboard){ //Determine whether it is empty
$where['keyboard']=[' like',"%$keyboard%"];
}
$count= $article->where($where)->count();// Query the total number of records that meet the requirements
$Page = new \Think\Page($count,5);// Instantiate the paging class and pass in the total number of records and the number of records displayed on each page (25)
$show = $Page->show() ;//Page display output
$list = $article->where($where)->order('time desc')->limit($Page->firstRow.','.$Page ->listRows)->select();
$this->assign('list',$list);// Assignment data set
$this->assign('page',$ show);// Assignment paging output
$this->display();
Print the SQL statement and then execute the SQL statement in the database to test and you will know the result
First make sure whether there is a keyboard field in your data. I think there should be no one.