I am using a varent from sparty2809 on http://tutorial323.easycfm.com/ It works
great but was created for ACCESS and uses an autonumber datatype. Its great
when you just keep adding advertisments but when you delete one there is now a
gap in the +one ADID (int - identity specification). When the RandRage counts
the MAX ADIDs and then picks a ad. If it hit the number that was deleted it
just shows.. nothing. This is a code breaker for me i cant have gaps.
ADID (int) w/ identity specification +1 //id
CompanyName (text) //name of banner
DatePosted (text) //date posted
HREF (varchar) //link
IMGSRC (varchar) //image source
Views (int) //# of views
Clicks (int) //# of clicks
Type (Text) //flash or image
<!--- Gets Maximum number of ads--->
<CFQUERY DATASOURCE="#Green#" NAME="GetMax">
SELECT Max(ADID) as MaxAD
FROM dbo.banner_left
</CFQUERY>
<!--- RandRange is Random integer between first number and second(1st,2nd) --->
<CFSET ADID = RandRange(1,GetMax.MaxAD)>
<!--- Calls up all columns in table --->
<CFQUERY DATASOURCE="#Green#" NAME="GetADs">
SELECT *
FROM dbo.banner_left
WHERE ADID = #ADID#
ORDER BY ADID
</CFQUERY>
<!--- incrementvalue Adds one to an integer, so it adds one to views--->
<CFSET add = incrementvalue(val(GetADs.views))>
<CFQUERY datasource="#Green#" name="AddView">
UPDATE dbo.banner_left
SET views = #add#
WHERE ADID = #ADID#
</CFQUERY>
<!--- Displays the ad flash or image --->
<cfif GetADs.Type IS "Flash">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="120"
height="600">
<param name="movie" value="<cfoutput>#GetADs.imgsrc#</cfoutput>">
<param name="quality" value="high">
<embed src="<cfoutput>#GetADs.imgsrc#</cfoutput>" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="120" height="600">
</embed>
</object>
<cfelse>
<cfoutput query="GetADs">
<a href="ads\ads_left_out.cfm?ADID=#ADID#" target="_blank">
<img src="ads\images\#imgsrc#" border="0">
</a>
</cfoutput>
</cfif>
I can use the rest of the code. Where do i start from here?
Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316227
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4