Home > Backend Development > PHP Tutorial > thinkphp3.2在Controller里为啥select没有数据

thinkphp3.2在Controller里为啥select没有数据

WBOY
Release: 2016-06-13 11:45:43
Original
755 people have browsed it

thinkphp3.2在Controller里为什么select没有数据?
刚学thinkphp,请大家多多指教。
class IndexController extends Controller {
    public function index(){
$Dao = M("Article");
        $articles = $Dao->select();    //用select检索不出数据
//$articles=$Dao->query("select * from think_Article" ); //用query有数据

        $this->assign('articles', $articles);
        // 输出模板
        $this->display();
    }
}

在application里也设置'DB_PREFIX' => 'think_'了。
运行环境:ubuntu、mysql。
为什么用select检索不出数据呢?请大家指教。谢谢。
------解决方案--------------------
$Dao = M("Article");
$articles = $Dao->select();    //用select检索不出数据
echo $Dao->getLastSQL();

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template