Discuz! 模板里面如何使用SQL语句调用数据
Discuz!模板里面如何使用SQL语句调用数据?最好详细点。分数不多知道的麻烦告诉声谢谢!...
Discuz! 模板里面如何使用SQL语句调用数据? 最好详细点。分数不多 知道的麻烦告诉声谢谢!
展开
2013-08-22
展开全部
一个站不能只有DZX,可能还有ECSHOP,可能也还有DEDECMS,那么模板里面支持SQL调用很有必要,而且也不局限于DZX后台内置的一些模块
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-22
展开全部
GET标签直接放到模板里面即可,了解GET标签结构很重要
get标签调用内容数据的标签结构
{get sql="SQL语句" rows="调用行数"}
显示内容方法{$r[需要显示的字段名]}
{/get}
get标签调用内容数据的标签结构
{get sql="SQL语句" rows="调用行数"}
显示内容方法{$r[需要显示的字段名]}
{/get}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-22
展开全部
帮你搜了下,不知道对你有帮助没1、调用含有图片的日志 SELECT * FROM `uchome_blog` WHERE `picflag` =1;
2、调用最近更新的10条日志 SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
3、调用最近更新的10个相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
说明:这是调用所有相册
加个条件:调用隐私设计为全站可见的相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) WHERE `friend` =0 ORDER BY dateline DESC
说明:friend值: '0'全站用户可见,'1'为全好友可见,'2'为仅指定的好友可见,'3'为仅自己可见,'4'为凭密码查看
4、调用最近的10条迷你博客 SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
5、调用我的话题 SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
6、调用3天内回复数最多的日志 SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC
7、调用选吧一周内的热点话题 select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC;
或者 SELECT * FROM uchome_ thread WHERE dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC;
8、调用最近3天注册的人,且按照降序排列 SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;
9、调用最后更新的10位会员 select * from uchome_space order by updatetime desc LIMIT 0,10;
10、将用户栏目的内容列表出来,并以用户积分作为排列顺序 SELECT * FROM uchome_spacefield sf, uchome_space s WHERE s.uid=sf.uid order by s.credit desc
说明:field_1为 uchome_spacefield 这个表要调用的用户栏目选择项,可以为field_1,field_2。。。
11、调用个人空间性别为女的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=2
12、调用个人空间性别为男的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=1
13、调用积分高的前10个会员 select * from uchome_space order by credit desc LIMIT 0,10;
14、调用访问量最大的空间 select * from uchome_space order by viewnum desc LIMIT 0,10;
15、调用指定用户的日志 SELECT * FROM `uchome_blog` WHERE uid =1 LIMIT 0 , 10
这是调用uid为1的10条记录
16、调用有头像的10个会员 SELECT * FROM `uchome_space` WHERE `avatar` =1 LIMIT 0 , 10
17、调用某一主题回复的内容 SELECT * FROM `uchome_post` WHERE tid =1 AND isthread =0 LIMIT 0 , 30;
上面的SQL语,可以调用主题id为1的30条回复
18、调用群组 SELECT * FROM `uchome_mtag` LIMIT 0 , 10
19、调用一周热门会员 select * from uchome_space WHERE dateline>=UNIX_TIMESTAMP() -3600*24*7 ORDER BY viewnum DESC LIMIT 0,18
20、调用发过帖子且有头像的会员 SELECT * from uchome_blog s,uchome_space sf where s.uid=sf.uid and sf.avatar=1
21、调用最热的群组 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and ORDER BY sf.membernum DESC LIMIT 0,10;
22、调用有图片的5个相册 SELECT * FROM `uchome_album` WHERE picflag =1 LIMIT 0 , 30
23、调用竞价排行 SELECT * FROM `uchome_show` ORDER BY credit DESC LIMIT 0,10;
24、调用最新上传的10张图片 SELECT * FROM `uchome_pic`order by dateline desc LIMIT 0,10;
25、调用有话题的群组 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid LIMIT 0 , 10
26、调用最新的10个群组 SELECT * FROM `uchome_mtag`ORDER BY tagid DESC LIMIT 0,10;
27、调用群主id为1的有头像的10个会员 SELECT * from uchome_tagspace s,uchome_space sf where s.uid=sf.uid and sf.avatar=1 AND s.tagid=1 ORDER BY sf.dateline DESC LIMIT 0,10;
28、调用单身的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.marry=1
29、调用实名认证用户 select * from uchome_space where `name`!=''
30、调用话题标题和所属群组名称 select * from uchome_mtag s,uchome_thread sf where s.tagid=sf.tagid ORDER BY sf.dateline DESC LIMIT 0,10;
31、随机调用用户的头像和用户名 SELECT * FROM `uchome_space` AS `space` LEFT JOIN `uchome_spacefield` AS `spacefield` on `space`.`uid`=`spacefield`.`uid` WHERE `space`.`avatar`='1' ORDER BY RAND()
32、调用指定群组的最新话题 select s.*,sf.* from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and sf.tagid=1 ORDER BY s.dateline LIMIT 0 , 10
2、调用最近更新的10条日志 SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
3、调用最近更新的10个相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
说明:这是调用所有相册
加个条件:调用隐私设计为全站可见的相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) WHERE `friend` =0 ORDER BY dateline DESC
说明:friend值: '0'全站用户可见,'1'为全好友可见,'2'为仅指定的好友可见,'3'为仅自己可见,'4'为凭密码查看
4、调用最近的10条迷你博客 SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
5、调用我的话题 SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
6、调用3天内回复数最多的日志 SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC
7、调用选吧一周内的热点话题 select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC;
或者 SELECT * FROM uchome_ thread WHERE dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC;
8、调用最近3天注册的人,且按照降序排列 SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;
9、调用最后更新的10位会员 select * from uchome_space order by updatetime desc LIMIT 0,10;
10、将用户栏目的内容列表出来,并以用户积分作为排列顺序 SELECT * FROM uchome_spacefield sf, uchome_space s WHERE s.uid=sf.uid order by s.credit desc
说明:field_1为 uchome_spacefield 这个表要调用的用户栏目选择项,可以为field_1,field_2。。。
11、调用个人空间性别为女的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=2
12、调用个人空间性别为男的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=1
13、调用积分高的前10个会员 select * from uchome_space order by credit desc LIMIT 0,10;
14、调用访问量最大的空间 select * from uchome_space order by viewnum desc LIMIT 0,10;
15、调用指定用户的日志 SELECT * FROM `uchome_blog` WHERE uid =1 LIMIT 0 , 10
这是调用uid为1的10条记录
16、调用有头像的10个会员 SELECT * FROM `uchome_space` WHERE `avatar` =1 LIMIT 0 , 10
17、调用某一主题回复的内容 SELECT * FROM `uchome_post` WHERE tid =1 AND isthread =0 LIMIT 0 , 30;
上面的SQL语,可以调用主题id为1的30条回复
18、调用群组 SELECT * FROM `uchome_mtag` LIMIT 0 , 10
19、调用一周热门会员 select * from uchome_space WHERE dateline>=UNIX_TIMESTAMP() -3600*24*7 ORDER BY viewnum DESC LIMIT 0,18
20、调用发过帖子且有头像的会员 SELECT * from uchome_blog s,uchome_space sf where s.uid=sf.uid and sf.avatar=1
21、调用最热的群组 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and ORDER BY sf.membernum DESC LIMIT 0,10;
22、调用有图片的5个相册 SELECT * FROM `uchome_album` WHERE picflag =1 LIMIT 0 , 30
23、调用竞价排行 SELECT * FROM `uchome_show` ORDER BY credit DESC LIMIT 0,10;
24、调用最新上传的10张图片 SELECT * FROM `uchome_pic`order by dateline desc LIMIT 0,10;
25、调用有话题的群组 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid LIMIT 0 , 10
26、调用最新的10个群组 SELECT * FROM `uchome_mtag`ORDER BY tagid DESC LIMIT 0,10;
27、调用群主id为1的有头像的10个会员 SELECT * from uchome_tagspace s,uchome_space sf where s.uid=sf.uid and sf.avatar=1 AND s.tagid=1 ORDER BY sf.dateline DESC LIMIT 0,10;
28、调用单身的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.marry=1
29、调用实名认证用户 select * from uchome_space where `name`!=''
30、调用话题标题和所属群组名称 select * from uchome_mtag s,uchome_thread sf where s.tagid=sf.tagid ORDER BY sf.dateline DESC LIMIT 0,10;
31、随机调用用户的头像和用户名 SELECT * FROM `uchome_space` AS `space` LEFT JOIN `uchome_spacefield` AS `spacefield` on `space`.`uid`=`spacefield`.`uid` WHERE `space`.`avatar`='1' ORDER BY RAND()
32、调用指定群组的最新话题 select s.*,sf.* from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and sf.tagid=1 ORDER BY s.dateline LIMIT 0 , 10
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询