ThinkPhp multi-table query

Source: Internet
Author: User
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.

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.