bluesauceuk
Programmer
Hello!
I would like to know if I can use CFCs to write to a database, passing the data from a form.
Does anyone know how to do this?
Here's my first cfc - that pulls info from the db
Then the page that calls it!
This works - but I would like to know how to add data. All that's in this table is decription!
I would like to know if I can use CFCs to write to a database, passing the data from a form.
Does anyone know how to do this?
Here's my first cfc - that pulls info from the db
Code:
<CFCOMPONENT>
<CFFUNCTION NAME="ListCategories"
HINT="ListCategories"
ACCESS="remote"
RETURNTYPE="query">
<CFQUERY DATASOURCE="aqua" NAME="category">
SELECT *
FROM category
</CFQUERY>
<CFRETURN category>
</CFFUNCTION>
</CFCOMPONENT>
Then the page that calls it!
Code:
<!--- Instantiate component --->
<CFOBJECT COMPONENT="category" NAME="empObj">
<!--- Get departments --->
<CFSET categories=empObj.ListCategories()>
<CFOUTPUT QUERY="categories">
#id#, #description# <br>
</CFOUTPUT>
Can anyone help?
This works - but I would like to know how to add data. All that's in this table is decription!