Thinkphp3.2 View model query bool (false) solution-php Tutorial

Source: Internet
Author: User
Thinkphp3.2 View model query bool (false) to solve
  array('picTitle','picToken','picCategroy','picAuthor','picPostTime','_type'=>'LEFT'),        'picture_attachment' =>array('pictureid','pictureurl','creattime','_on'=>'picture.picToken = picture_attachment.pictureid'),    );}

Two picture and picture_attachment tables
I use the D method to instantiate PicView written in the controller. Is this a real table name in the database?
    public function  Pic(){         $PicModel =D('PicView');        dump($PicModel);         $s =   $PicModel->select();        dump($s);    }


Returned errors
["Db": protected] => object (Think \ Db \ Driver \ Mysql) #8 (19 ){
["DbType": protected] => NULL
["AutoFree": protected] => bool (false)
["Model": protected] => string (7) "_ think _"
["Pconnect": protected] => bool (false)
["QueryStr": protected] => string (0 )""
["ModelSql": protected] => array (0 ){
}
["LastInsID": protected] => NULL
["NumRows": protected] => int (0)
["NumCols": protected] => int (0)
["TransTimes": protected] => int (0)
["Error": protected] => string (0 )""
["LinkID": protected] => array (0 ){
}
["_ LinkID": protected] => NULL
["QueryID": protected] => NULL
["Connected": protected] => bool (false)
["Autoinc": protected] => bool (false)
["PatchValidate": protected] => bool (false)


Reply to discussion (solution)

# Initialize the PicView model. if the PicView class exists, call and initialize it. if the class does not exist, initialize the model based on the table name $ PicModel = D ('picview '); # The SQL statement used to output all data is # SELECT * FROM PicView $ s = $ PicModel-> select ();

PHP beginners are not recommended to directly look at the framework!

# Initialize the PicView model. if the PicView class exists, call and initialize it. if the class does not exist, initialize the model based on the table name $ PicModel = D ('picview '); # The SQL statement used to output all data is # SELECT * FROM PicView $ s = $ PicModel-> select ();

PHP beginners are not recommended to directly look at the framework!


Thank you! I have solved the problem that the sorting of fields in the two tables is different, which makes other good frameworks easy to use.

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.