[ecmsinfo]”select * from phome_ecms_news order by rand() desc limit 6 “,6,18,1,24,11,1[/ecmsinfo]

 

指定栏目

 

[ecmsinfo]”select   from  phome_ecms_news classid  in  (id1,id2,id3….) order  by  rand()  desc  limit   “,6,18,1,24,11,1[/ecmsinfo]

 

classid=’$GLOBALS[navclassid]’  当前栏目

 

SELECT *
FROM `table` AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM `table`)-(SELECT MIN(id) FROM `table`))+(SELECT MIN(id) FROM `table`)) AS id) AS t2
WHERE t1.id >= t2.id
ORDER BY t1.id LIMIT 1;

推荐图片随机展示代码:
======================================================================
[phomenewspic]’selfinfo’,3,9,80,45,0,20,2[/phomenewspic]
【加入SQL语句,随机读取。】
======================================================================
[phomenewspic]”select * from phome_ecms_photo order by rand() desc limit 9″,3,9,80,45,0,20,2[/phomenewspic]
【操作类型为24。SQL操作。】
======================================================================
[phomenewspic]”select * from phome_ecms_photo order by rand() desc limit 9″,3,9,80,45,0,20,24[/phomenewspic]
【读取推荐图片】
======================================================================
[phomenewspic]”select * from phome_ecms_photo where isgood=1 and titlepic<>” order by rand() desc limit 9″,3,9,80,45,0,20,24[/phomenewspic]
【读取指定栏目下的推荐图片】
======================================================================
[phomenewspic]”select * from phome_ecms_photo where classid in (1,3) and isgood=1 and titlepic<>” order by rand() desc limit 9″,3,9,80,45,0,20,24[/phomenewspic]
【在当前栏目中查询】
======================================================================
[phomenewspic]”select * from phome_ecms_photo where classid=’$GLOBALS[navclassid]’ and isgood=1 and titlepic<>” order by rand() desc limit 9″,3,9,80,45,0,20,24[/phomenewspic]

 

 

[ecmsinfo]”select * from phome_ecms_news where classid in (3) and title like ‘%南京%’ order by rand() desc limit 10″,10,28,0,24,9,0[/ecmsinfo]