帝国仿站教程 多表查询+多表标题链接的调用
多表查询+多表标题链接的调用
1 | [e:loop={ "select a.*,b.gsjc from phome_ecms_news a LEFT JOIN phome_ecms_gssj b on a.gsid=b.id where a.classid in (8) order by a.newstime desc limit 1",5,24,0}] |
以上A为第一个表 B为第二个表
1 2 3 4 5 6 7 | < li > < a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></ a > 这个是第一个表的标题链接及标题 < a href=" <? $r=$empire->fetch1("select titleurl,groupid,classid,newspath,filename,id from phome_ecms_gssj where id='$bqr[gsid]' limit 1"); $titleurl=sys_ReturnBqTitleLink($r); echo $titleurl;?> "> 这个是第二个表的标题链接 <?=$bqr[gsjc]?></ a > 这个是第二个表的标题 </ li >[/e:loop]</ ul > |
第二个表的标题链接蓝色部分不用修改 ID 对应第一个查询的ID即可