Home >CMS Tutorial >PHPCMS >What should I do if phpcms get sql does not output results?

What should I do if phpcms get sql does not output results?

藏色散人
藏色散人Original
2020-01-14 09:26:002477browse

What should I do if phpcms get sql does not output results?

What should I do if phpcms get sql does not output the result?

PHPcms v9 get tag sql statement limit invalid solution

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. There are 2 methods, of which the second method is the best. Just paste 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"}

can be controlled by adding start and num.

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!

PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!

The above is the detailed content of What should I do if phpcms get sql does not output results?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn