Get the App
SLTechnology News&Howtos  ›  Servers  › 

The solution to the ineffectiveness of limit in phpcms

Shulou Source: shulou.com Published: 2022-06-02 05:51:19 10月02日 Update

What is the solution that limit doesn't work in phpcms? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

What if phpcms limit doesn't work?

Recently, when I was doing a station with PHPCMS V9, I found that get tags are very easy to use. After customizing the model, get has become almost omnipotent. However, after upgrading PHPCMS to V9, many functions of 2008 have been removed, such as the get tag, which automatically adds a LIMIT 0LI 20, so that it is useless even if you write the num=' number', in the SQL statement, for example

{pc:get sql= "SELECT * FROM v9_news ORDER BY id DESC LIMIT 2 data 5" cache= "3600" page= "$page" dbsource= "discuz" return= "data"}

An error will be reported, and the printed SQL statement is:

SELECT * FROM v9_news ORDER BY id DESC LIMIT 2 LIMIT 5 LIMIT 0 Magi 20

This is obviously wrong. Two methods have been found on the forum, of which the second method is the best, posting the code directly:

1. such as

{pc:get sql= "SELECT title,url FROM v9_news where catid=9 and status=99 order by updatetime desc" start= "0" num= "4" return= "v"}

It can be controlled by adding start and num.

two。 (a more unique method)

{pc:get sql= "SELECT title,url FROM v9_news where catid=9 and status=99 order by updatetime desc limit 0jin4muri -" return= "v"} Thank you for your reading! After reading the above, do you have a general understanding of the solution that limit does not work in phpcms? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Tags: Methods content functions articles tags statements questions obvious code functions what to do numbers more models look industries forums information channels errors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Microsoft Linux MySQL