Do you get the same thing if you do the math outside?

<cfquery datasource="applewood" name="Getinfo3"> SELECT * FROM ImageData
WHERE ImageID = #ListRandImage# </cfquery> 

<CFSET NewPageViews = val(Getinfo3.PageViews) + 1>

<cfquery DATASOURCE="#mydbname#" NAME="UpdateData"> INSERT INTO ImageData  (
  PageViews,
  ImageID,
  ImageShowDate
 )
VALUES
 (
  #Val(NewPageViews)#,
   #ListRandImage#,
  #createodbcdate(now())#
 )
</cfquery>

-----Original Message-----
From: Phillip Perry [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 22, 2004 5:52 PM
To: CF-Talk
Subject: Problem With Insert

I'm trying to update the pageviews + 1 every time a banner is shown on the
browser. But for some reason my code stopped at 2. It wont go any higher.
The first and second times the code updated correctly. It went from 1
pageview to 2 pageviews..now everything is 2 pageviews even though there are
at least 3 in the db. Here is my code...The highlighted portion of the code
is my addition statement. I seem to think its about my calling pageviews
from getinfo3 but i cant wrap my noggin around it.

....<cfquery datasource="applewood" name="Getinfo3">
SELECT *
FROM ImageData
WHERE ImageID = #ListRandImage#
</cfquery>
<cfquery DATASOURCE="#mydbname#" NAME="UpdateData">
INSERT INTO ImageData
 (
  PageViews,
  ImageID,
  ImageShowDate
 )
VALUES
 (
  (#Getinfo3.PageViews# + 1),
   #ListRandImage#,
  #createodbcdate(DateFormat(now(), "mm/dd/yyyy"))#
 )
</cfquery>

Any thoughts?

Phil






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=36

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182421
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to