Home > CMS Tutorial > PHPCMS > body text

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

藏色散人
Release: 2020-01-14 09:26:00
Original
2312 people have browsed it

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"}
Copy after login

will report an error, and the printed SQL statement is:

SELECT * FROM v9_news ORDER BY id DESC LIMIT 2,5 LIMIT 0,20
Copy after login

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"}
Copy after login

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"}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!