thinkphp多表联合查询

1.两个表查询

field('projectno')->where(array('id'=>$userid))->select(); $xq = M('project'); $datas = $xq->field('name')->where(array('id'=>$data[0][projectno]))->select(); $this->assign('xq',$datas); $this->assign('title',$datas[0][name].'物业系统');

2.联合查询:联合查询需要写表的全名。

join('INNER JOIN pro_project ON pro_cuser.projectno = pro_project.id')->where(array('pro_cuser.id'=>$userid))->select(); $this->assign('xq',$data); $this->assign('title',$data[0][name].'物业系统');

相关文章

(1)创建数据表: CREATE TABLE IF NOT EXISTS `think_form` ...
组合查询的主体还是采用数组方式查询,只是加入了一些特殊的...
(1)创建模版:/App/Home/View/Form/edit.html   <FORM m...
自定义配置文件user.php: <?php return array(    \'se...
在一些成熟的CMS系统中,后台一般都包含一个配置中心(如织梦...
废话不多说先上图预览下,即本博客的分页; 这个分页类是在...