[英]ColdFusion RecordCount as multiple conditional
I would like to run one query + output and in case no records exist run second query + output and in case both have no records then redirected to 我想运行一个查询+输出,并在没有记录的情况下运行第二个查询+输出,并且如果都没有记录,然后重定向到
<test1.RecordCount eq 0>
but the problem is that I can only use one <cfelse>
但问题是我只能使用一个
<cfelse>
Any idea? 任何想法?
The Code for one query + output and RecordCount 一个查询+输出和RecordCount的代码
<cfif test1.RecordCount eq 0>
<!--- Display some message.--->
<cfelse>
<cfoutput query="test1">
<!--- Display some other message --->
</cfoutput>
</cfif>
If I understand your question correctly, you should be able to use nested <cfif ...>
conditions. 如果我正确理解了您的问题,则应该可以使用嵌套的
<cfif ...>
条件。
Something like: 就像是:
<cfif test1.RecordCount gt 0>
<cfoutput query="test1">
<!--- Display test1 query results --->
</cfoutput>
<cfelse>
<cfif test2.RecordCount gt 0>
<cfoutput query="test2">
<!--- Display test2 query results --->
</cfoutput>
<cfelse>
<!--- Display some message.--->
</cfif>
</cfif>
Or you could use <cfelseif>
like this: 或者,您可以像这样使用
<cfelseif>
:
<cfif test1.RecordCount gt 0>
<cfoutput query="test1">
<!--- Display test1 query results --->
</cfoutput>
<cfelseif test2.RecordCount gt 0>
<cfoutput query="test2">
<!--- Display test2 query results --->
</cfoutput>
<cfelse>
<!--- Display some message.--->
</cfif>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.