Home > Article > CMS Tutorial > What to do if phpcms limit doesn’t work
What should I do if phpcms limit doesn’t work?
I recently used PHPCMS V9 to build a website and found that the get tag is very easy to use. After customizing the model, get becomes almost universal. However, after PHPCMS was upgraded to V9, many functions of 2008 were removed. For example, in the get tag, a LIMIT 0,20 was automatically added at the end. In this way, even if you write num='number', it will be useless. Write it in the SQL statement. Inside, for example
{pc:get sql="SELECT * FROM v9_news ORDER BY id DESC LIMIT 2,5" cache="3600" page="$page" dbsource="discuz" return="data"}
will report an error, and the printed SQL statement is:
SELECT * FROM v9_news ORDER BY id DESC LIMIT 2,5 LIMIT 0,20
This is obviously wrong. I found 2 methods on the forum, of which the second method is the best. Post the code directly:
1. For example,
{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"}
You can add start and num to control.
2. (A more absolute method)
{pc:get sql="SELECT title,url FROM v9_news where catid=9 and status=99 order by updatetime desc limit 0,4--" return="v"}
Pay attention to the two minus signs after 4 and comment out the LIMIT 0,20 statement that comes with v9!
Related recommendations: phpcms tutorial
The above is the detailed content of What to do if phpcms limit doesn’t work. For more information, please follow other related articles on the PHP Chinese website!