最新公告
  • 新添加WordPress仿站助手小工具,方便大家开发制作WP模板的利器 . Wordpress标签生成器
  • 帝国CMS MYSQL随机调用速度比拼及方法

    正文概述 仿站吧   2024-03-05 21:00:39  
    帝国CMS MYSQL随机调用速度比拼及方法 

    第一种

    select a.* from phome_ecms_news a join (select round((select max(id) from phome_ecms_news) * rand()) as rid from phome_ecms_news limit 10) b where a.id = b.rid

    第二种

    select * from phome_ecms_news where rand()<0.015 limit 10

    第三种

    $sql=$empire->query("SELECT * FROM {$dbtbpre}ecms_news WHERE id >= ((SELECT MAX(id) FROM {$dbtbpre}ecms_news)-(SELECT MIN(id) FROM {$dbtbpre}ecms_news)) * RAND() + (SELECT MIN(id) FROM {$dbtbpre}ecms_news) ORDER BY id limit 10");

    第四种

    只适合在内容页模板调用

    select * from {$dbtbpre}ecms_news where classid='$navinfor[classid]' and  id>'$navinfor[id]'-1000 and id<'$navinfor[id]'+1000 order by rand() limit 10

    第五种

    select * from {$dbtbpre}ecms_news order by rand() limit 10
    仿站吧,一个优质的源码资源平台!
    仿站吧 » 帝国CMS MYSQL随机调用速度比拼及方法