thinkphp 3.2 View model query out BOOL (FALSE) solution

Source: Internet
Author: User
thinkphp 3.2 View model query out bool (false) solve
It's written in this model.
 
  namespace Home\model;
Use Think\model\viewmodel;
Class Picviewmodel extends viewmodel{
Public $viewFields =array (
' Picture ' = = Array (' Pictitle ', ' pictoken ', ' Piccategroy ', ' picauthor ', ' picposttime ', ' _type ' = ' left '),
' Picture_attachment ' =>array (' Pictureid ', ' pictureurl ', ' creattime ', ' _on ' = ' picture.pictoken ' = picture_ Attachment.pictureid '),

);
}

Picture and picture_attachment two tables
That's what the controller says. I instantiate Picview with the D method. Is this the real table name that must be in the database?
    Public Function  Pic () {
$PicModel =d (' Picview ');

Dump ($PicModel);
$s = $PicModel->select ();
Dump ($s);

}


Some of the errors returned
["DB":p rotected] + object (think\db\driver\mysql) #8 (19) {
["DbType":p rotected] = NULL
["Autofree":p rotected] = bool (false)
["Model":p rotected] and string (7) "_think_"
["Pconnect":p rotected] = bool (false)
["Querystr":p rotected] = string (0) ""
["Modelsql":p rotected] = = Array (0) {
}
["Lastinsid":p rotected] = NULL
["NumRows":p rotected] = Int (0)
["Numcols":p rotected] = Int (0)
["Transtimes":p rotected] = Int (0)
["Error":p rotected] + string (0) ""
["LinkID":p rotected] = = Array (0) {
}
["_linkid":p rotected] = NULL
["Queryid":p rotected] = NULL
["Connected":p rotected] = bool (false)
["Autoinc":p rotected] = bool (false)
["Patchvalidate":p rotected] = bool (false)
------to solve the idea----------------------

# Picview Model initialization, if the Picview class exists, is called and initialized and, if not present, initializes the model based on the table name
$PicModel =d (' Picview ');

The SQL statement that #输出所有数据 actually executes is
# SELECT * from Picview
$s = $PicModel->select ();

PHP Beginners do not recommend looking directly at the frame!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.