Home > Article > CMS Tutorial > How to sort in descending order in phpcms
How to implement descending order of phpcms: first find and open the "formguide_fields.class.php" file; then find the "listview" method part in the file; then add the statement "order by dataid desc" in the corresponding position of the code ;Save at last.
phpcms form information is arranged in reverse order (arranged in descending order by ID) code modification!
I was really drunk and searched for a long time, but I still found the list function from paging. The phpcms form information is arranged in reverse order (in descending order by ID) and the code is modified.
In formguide\admin\include \formguide_fields.class.php, find:
function listview($page = 1, $pagesize = 30) { $page = max(intval($page), 1); $offset = $pagesize*($page-1); $limit = " LIMIT $offset, $pagesize"; //phpfensi.com $result = $this->db->query("SELECT * FROM $this->tablename $limit");
Add "order by dataid desc" (note the space) desc before "$limit" in "SELECT * FROM $this->tablename $limit" Descend means descending order asc means ascend ascending order.
Recommended: "phpcms tutorial"
The above is the detailed content of How to sort in descending order in phpcms. For more information, please follow other related articles on the PHP Chinese website!