ThinkPhp multi-table query problem. Please help PHPcodepublicfunctiongraduate () {$ this-& gt; checkLogin (); determine logon $ GraduateM (Graduate); $ category $ _ GET [category]; $ map [ThinkPhp multi-table query problem, please help
PHP code
Public function graduate () {$ this-> checkLogin (); // judge logon $ Graduate = M ('graduate'); $ category = $ _ GET ['Category ']; $ map ['flg'] = '0'; $ map ['Lan '] = '01'; import ("@. ORG. page "); $ count = $ Graduate-> join ('left outer join person on (GRADUATE. PERSONID = PERSON. PERSONID andPERSON. FLG = '. $ FLG. ')-> where ($ map)-> count (); $ p = new Page ($ count, 10 ); $ list = $ Graduate-> limit ($ p-> firstRow. ','. $ p-> listRows)-> join ('left outer join person on graduate. PERSONID = PERSON. PERSONID and PERSON. FLG = 0')-> where ($ map)-> order ('graduate. graduateid desc ')-> findAll (); $ page = $ p-> show (); $ pagenumber = $ p-> nowPage; $ this-> assign ("pagenumber ", $ pagenumber-1) ;this this-> assign ("page", $ page); $ this-> assign ("list", $ list ); $ this-> display ();}
The personID of the Graduate table is the foreign key of the Person table. The value cannot be found after join. Which of the following heroes can help you with the problem?
Also, is this case sensitive?
Ps: No php, but the boss asked me to buy a bug...
------ Solution --------------------
$ List = $ Graduate-> limit ($ p-> firstRow. ','. $ p-> listRows)-> join ('left outer join person on graduate. PERSONID = PERSON. PERSONID and PERSON. FLG = 0')-> where ($ map)-> order ('graduate. graduateid desc ')-> findAll ();
Later:
Echo $ Graduate-> getLastSql ();
Check what the last SQL statement is and whether the SQL statement is incorrect.