代码如下:
{dede:sql sql='select * from dede_member where mtype="个人" order by mid limit 0,12'} <a href=http://www.dede58.com/a/member/index.php?uid=[field:userid/] target='_blank'>[field:uname/]</a> {/dede:sql}代码如下:
{dede:sql sql='select * from dede_member where mtype="企业" order by mid limit 0,12'} <a href=http://www.dede58.com/a/member/index.php?uid=[field:userid/] target='_blank'>[field:uname/]</a> {/dede:sql}详解使用dede的sql标签:
select * from dede_member where mtype="个人" order by mid limit 0,12
mtype="个人" :判断是否为个人类型
order by mid :其中mid是按注册的ID编号排列,将mid换成logintime则为按登录时间排序;
limit 0,12 :从第0条数据开始读取 读取12条后返回
案例解析:
调取所有会员中的12个按最后登录时间排序
代码如下:
{dede:sql sql='select * from dede_member order by logintime limit 0,12'} <a href=http://www.dede58.com/a/member/index.php?uid=[field:userid/] target='_blank'>[field:uname/]</a> {/dede:sql}调取12个上传了头像的会员 按最后登录时间排序 并显示出他们的头像
代码如下:
{dede:sql sql='select * from dede_member where length(face)>0 order by logintime limit 0,12'} <a href=http://www.dede58.com/a/member/index.php?uid=[field:userid/] target='_blank'><img src=http://www.dede58.com/[field:face/] /></a> {/dede:sql}