帖子详情
 
 
  • [帝国cms教程]帝国cms统计SQL查询记录相对于num更高效函数的教程
  • 白银会员 Ecmsphp开发中心 只看楼主 5 年前
  • 帝国cms统计SQL查询记录相对于num更高效函数介绍,是教大家如何查询统计SQL记录函数的教程。


    $empire->gettotal("统计SQL语句");

    说明:

    gettotal()和num()的区别是:gettotal()采用SQL本身的count(*)函数来统计,而num()是采用PHP本身的函数,gettotal()更高效一些。

    gettotal()里的统计数一定要as total,如:“count(*) as total”。

    使用范例:

    $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news");

    echo"新闻表共有 ".$num." 条新闻";


    以上是统计SQL查询记录相对于num更高效函数的教程。

  • 收藏 推荐 打赏微信打赏 举报
共有条回复