search
HomeCMS TutorialPHPCMSWhat should I do if phpcms get sql does not output results?

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use