Dedecms an empty SQL query for an output value

Source: Internet
Author: User

Dede SQL statement execution, when the query statistics result is 0 o'clock, does not output any value, when the data is normal.

The workaround is to determine if the statistic result is empty, and the statistic field value is reset for null.

The code is as follows: When the statistics are published today, if not, the output is none, and the number of output statistics.

{dede:sql sql= ' select COUNT (*) as mycount from Dede_archives where typeid=24 and pubdate > Unix_timestamp (curdate ()) '}

[Field:mycount runphp= ' yes ']

if (empty (@me)) {

@me = "None";

}

[/field:mycount]

{/dede:sql}

Note:

[Field:mycount runphp= ' yes '] for field information, to be processed, @me represent the value of the current field, modify the return value, the direct assignment @me can be.

The Echo output value of this code snippet is not printed in the foreground, but in the background build interface.

Dedecms an empty SQL query for an output value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.