Ok, here's my latest test on this. It's 11:45 pm so bear with me! :)
Example no.1 inserts 2 records in tblSearches. Record 1 is correct - a string,
a date, and a recordcount. Record 2 is an empy string for searchwords, a
correct date, and a recordcount of 0.
The form:
<form action="productsearch.cfm" method="post">
<input name="criteria" type="text" size="10" />
<input name="goButton" type="submit" value="search" />
</form>
The action page:
<cfparam name="FORM.criteria" default="">
<!--- Call the DAO for categories--->
<cfset prodcategories = APPLICATION.productDAO.getCategories()>
<!--- Call the DAO for get featured products --->
<cfset getfeaturedproducts = APPLICATION.productDAO.getfeaturedproducts()>
<!---Call the DAO to retrieve products by form criteria --->
<cfset getsearchproducts =
APPLICATION.productDAO.searchProducts(criteria=FORM.criteria)>
<!--- Insert this search into the database --->
<cfinvoke component="#APPLICATION.productDAO#" method="insertSearch"
criteria="#FORM.criteria#"
searchreturncount="#getsearchproducts.recordcount#">
Here's the insert from productDAO.cfc:
<cffunction name="insertSearch" access="public" output="false" hint="Adds
search to db">
<cfargument name="criteria" required="yes" type="string">
<cfargument name="searchreturncount" required="yes" type="numeric">
<cfset var insertsearch = "">
<cfquery datasource="#VARIABLES.dsn#" name="insertsearch">
INSERT INTO tblSearches (searchwords, searchdate, searchreturns)
VALUES (<cfqueryparam value="#ARGUMENTS.criteria#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#DateFormat(Now(),
"M/DD/YYYY")#">,
<cfqueryparam cfsqltype="cf_sql_smallint"
value="#ARGUMENTS.searchreturncount#">
)
</cfquery>
</cffunction>
Ok, if I simply remove the cfparam -<cfparam name="FORM.criteria" default="">
from the action page, it correctly inserts just one record.
I'm tired, and I feel like I'm koo koo for cocoa puffs after workin' on this.
Thanks and goodnight!
Will
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226903
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