帝國CMS自定義列表的排序


統計記錄: select count(*) as total from [!db.pre!]ecms_movie

查詢記錄: select * from [!db.pre!]ecms_movie order by id desc

注釋:[!db.pre!]ecms_movie 為數據表類型(movie是電影數據表)

desc - 降序排列 ASC - 升序排列

id desc 是按id降序排列 id ASC 是按id升序排列

舉一反三排序方式:id(id)、newstime (時間)、onclick(點擊或瀏覽)、p統計記錄: select count(*) as total from [!db.pre!]ecms_movie

查詢記錄: select * from [!db.pre!]ecms_movie order by id desc

注釋:[!db.pre!]ecms_movie 為數據表類型(movie是電影數據表)

desc - 降序排列 ASC - 升序排列

id desc 是按id降序排列 id ASC 是按id升序排列

舉一反三排序方式:id(id)、newstime (時間)、onclick(點擊或瀏覽)、plnum (評論)、diggtop 、rand (隨機)

如:增加當前欄目(一般是錯誤的,因自定義列表不能用當前欄目這個參數,這是只是一個引用以備其他地方應用)
where classid='$GLOBALS[navclassid]'當前欄目

統計記錄: select count(*) as total from [!db.pre!]ecms_movie where classid='$GLOBALS[navclassid]'

查詢記錄: select * from [!db.pre!]ecms_movie where classid='$GLOBALS[navclassid]' order by id desc

---------------------------------------------------------------------------

自定義列表調用多個欄目,或指定欄目(sql中指定的欄目ID必須為終極欄目ID)

統計記錄: select count(*) as total from [!db.pre!]ecms_movie where classid in (23,24,25)

查詢記錄: select * from [!db.pre!]ecms_movie where classid in (23,24,25) order by id desc

lnum (評論)、diggtop 、rand (隨機)

如:增加當前欄目(一般是錯誤的,因自定義列表不能用當前欄目這個參數,這是只是一個引用以備其他地方應用)
where classid='$GLOBALS[navclassid]'當前欄目

統計記錄: select count(*) as total from [!db.pre!]ecms_movie where classid='$GLOBALS[navclassid]'

查詢記錄: select * from [!db.pre!]ecms_movie where classid='$GLOBALS[navclassid]' order by id desc

---------------------------------------------------------------------------

自定義列表調用多個欄目,或指定欄目(sql中指定的欄目ID必須為終極欄目ID)

統計記錄: select count(*) as total from [!db.pre!]ecms_movie where classid in (23,24,25)

查詢記錄: select * from [!db.pre!]ecms_movie where classid in (23,24,25) order by id desc


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM