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.