public function showList(){ $model =D('article'); $total=$model->count('id'); $this->assign('total',$total);// 赋值分页输出 $this->display(); // 输出模板 }//showlist end
The count here must be added with the id parameter, otherwise an error will be reported. May I ask why?
The error is as follows:
1054:Unknown column '*' in 'field list' [SQL statement]: SELECT COUNT(`*`) AS tp_count FROM `xh_article` LIMIT 1The database structure is as follows Shown:
What version is this 3.? count() can be used without passing a value. If an error is reported, look for the source code of the count method and look at the source code.
Don’t worry too much about this small problem, and your version is too low. Study the new version more and keep up with the progress