Copy link to clipboard
Copied
Copy link to clipboard
Copied
Write a union query, selecting 1 in the other half.
Copy link to clipboard
Copied
you mean loop or give sample
Copy link to clipboard
Copied
Not really sure what you're asking, but how about a dirty:
<cfif selectVisitorTimes.RECORDCOUNT >
<cfset Visited = selectVisitorTimes.colname />
<celse>
<cfset Visited = 1 />
</cfif>
That'd work.
Copy link to clipboard
Copied
I didn't mean loop, I meant union query. If you don't know what that is, I've heard good things about the book, Teach Yourself SQL in 10 Minutes.
Alternatively, you can try the approach suggested by Owain North. However, in your cfelse block, you'd have to use ColdFusion query functions, not a simple cfset.
Copy link to clipboard
Copied
in cfelse this is ok?
<cfparam name="TimesVisited" default="1">
what you mean by "ColdFusion query functions" ?
Copy link to clipboard
Copied
The cfelse you suggested will not satisfy the requirements you stated in your original post.
By "ColdFusion query functions", I mean the functions in ColdFusion that enable you to create and manipulate query objects. If you google that very string, and look for any offerings by adobe, you will quickly find the names of the three functions you need and instructions on how to use them.
Copy link to clipboard
Copied
The full extent of what you wish to do is:
Copy link to clipboard
Copied
what if rather <cfset Visited = 1 />
have
<cfparam name="Visited" default="1">
???
Copy link to clipboard
Copied
123polis123 wrote:
what if rather <cfset Visited = 1 />
have
<cfparam name="Visited" default="1">
<cfelse>
<!---Here the variable visited is undefined, so the cfparam will have the same effect as the cfset--->
</cfif>
Copy link to clipboard
Copied
<cfparam name="cookie.countNumVisitor" default="-1">
<cfset countNumVisitor = cookie.countNumVisitor>
i used above but in FF Browser I got two cookie values in the two names of COUNTNUMVISITOR, How get only one?
Copy link to clipboard
Copied
is any function check if cookies exist or not, without set up to default value?
Copy link to clipboard
Copied
<cfcookie name="countNumVisitor" value="#countNumVisitor#" expires="never" domain=".polis.com" path="/">
<cfset cookie.countNumVisitor = selectVisitor.recordcount>
these two methods are correct both, to setup a cookie? site wide cookie...
Copy link to clipboard
Copied
123polis123 wrote:
<cfcookie name="countNumVisitor" value="#countNumVisitor#" expires="never" domain=".polis.com" path="/">
<cfset cookie.countNumVisitor = selectVisitor.recordcount>
these two methods are correct both, to setup a cookie? site wide cookie...
<cfcookie name="countNumVisitor" value="#selectVisitor.recordcount#" expires="never" domain=".polis.com">
and
<cfset cookie.countNumVisitor = selectVisitor.recordcount>
are both valid. However, the first gives you more control.
Copy link to clipboard
Copied
If he's still using the query in the OP, the recordcount will always be one. That means my suggestion of a union query was not appropriate. Something like this should work.
select case when records > 0 then records else 1 end VisitorCount
from
(select count(*) records e
etc
) temp
Copy link to clipboard
Copied
123polis123 wrote:
is any function check if cookies exist or not, without set up to default value?
<cfif isDefined("cookie.countNumVisitors")>
</cfif>
Copy link to clipboard
Copied
function(){return A.apply(null,[this].concat($A(arguments)))}function(){return A.apply(null,[this].concat($A(arguments)))}function(){return A.apply(null,[this].concat($A(arguments)))} 123polis123 wrote:
<cfparam name="cookie.countNumVisitor" default="-1">
<cfset countNumVisitor = cookie.countNumVisitor>
i used above but in FF Browser I got two cookie values in the two names of COUNTNUMVISITOR, How get only one?
I would first delete any existing cookie values before setting a new one. To delete a cookie, do this
<cfcookie name="countNumVisitor" expires="now">
Alternatively, you could just overwrite the cookie value by resetting it.