Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Weighted Banner Rotation Script

Posted on 2005-04-29
5
Medium Priority
?
179 Views
Last Modified: 2013-12-24
Hi,

I have found a script to rotate banners using a database which is weighter however I am getting the following error when I test the page:

Error Diagnostic Information

An error occurred while evaluating the expression:


#add#



Error near line 40, column 36.
--------------------------------------------------------------------------------

Error resolving parameter ADD


ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:

You have misspelled the parameter name, or
You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.

Here is the section of the code that is generating the error. I have highlighted the line with a comment tag:

<!--- This queries the specific banner --->
<cfquery datasource="YourDSN" name="views">
select *
from banners
where id = #magicnum#
</cfquery>
<!--- start Adds 1 to view --->
<cfoutput query="views">
<CFSET add = #ban_views# + 1>                           <!--- This is the problem line --->
<CFQUERY datasource="YourDSN" name="UpdateView">
UPDATE Banners Set ban_views = #add# where ID = #id#
</cfquery>
</cfoutput>
<!--- End Adds 1 to view --->

Can someone help me?

0
Comment
Question by:cmaorg
  • 2
  • 2
5 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 13899737
<cfoutput query="views">
<CFSET add = ban_views + 1>                           <!--- This is the problem line --->
<CFQUERY datasource="YourDSN" name="UpdateView">
UPDATE Banners Set ban_views = #add# where ID = #id#
</cfquery>
</cfoutput>
0
 

Author Comment

by:cmaorg
ID: 13900462
I am still gettting the error. Help!!!!



0
 
LVL 21

Expert Comment

by:pinaldave
ID: 13900637
Q:)
why are you using cfoutput query="views">
do you mean to have loop....
otherwise you can do this...

 <cfoutput>
<CFSET add = views.ban_views + 1>                           <!--- This is the problem line --->
<CFQUERY datasource="YourDSN" name="UpdateView">
UPDATE Banners Set ban_views = #add# where ID = #id#
</cfquery>
</cfoutput>
0
 
LVL 7

Accepted Solution

by:
andw928 earned 2000 total points
ID: 13901114
cmaorg, try this, the easy efficient way:
                   
<cfquery name="UpdateView" datasource="YourDSN">
    UPDATE Banners
        SET ban_views = ban_views+1
        WHERE id = '#magicnum#'
</cfquery>


This is all you need, you don't need the first query, you don't need the loop, you don't need that variable, just try this alone, and tell me what you get.

-Matt
0
 

Author Comment

by:cmaorg
ID: 13901220
Thanks so much for your help! It works perfectly now.

;-)
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question