No problem,
I am running MySQL 4.0.25 remotely on my production server and 4.1.12
on my local box.
I have designed part of my newsletter component, here it is thus far:
<cfcomponent>
<cffunction name="insertSubscriber" access="public" returntype="struct">
<cfargument name="user_ID" type="string" required="yes">
<cfargument name="newscat_ID" type="numeric" required="yes">
<!--- creat structure result --->
<cfset insertSubscriber = structNew()>
<cfset inssertSubscriber.status ="success">
<cftry>
<cfquery name="rsInsertSubscriber"
datasource="#application.dsn#">
INSERT INTO NewsUsers (
user_ID,
newsCat_ID,
newsusersActive)
VALUES (
"#arguments.userID#",
#arguments.newscatID#,
1)
</cfquery>
<cfcatch type="any">
<cfset insertSubscriber.status = "failure">
<cfset insertSubscriber.subscriberID = 0>
</cfcatch>
</cftry>
<cfreturn insertSubscriber>
</cffunction>
<cffunction name="updateSubscriptions" access="public"
returntype="struct">
<cfargument name="user_ID" type="string" required="yes">
<cfargument name="newscat_ID" type="numeric" required="yes">
<cfargument name="newsusersActive" type="boolean"
required="yes">
<!--- creat structure result --->
<cfset updateSubscriptions = structNew()>
<cfset updateSubscriptions.status ="success">
<cftry>
<cfquery name="rsupdateSubscriptions"
datasource="#application.dsn#">
UPDATE NewsUsers (
newsusersActive)
VALUES (
#newsusersActive#)
WHERE user_ID = #arguments.userID#
AND newscat_ID = #arguments.newscat_ID#
</cfquery>
<cfcatch type="any">
<cfset updateSubscriptions.status = "failure">
<cfset updateSubscriptions.subscriberID = 0>
</cfcatch>
</cftry>
<cfreturn insertSubscriber>
</cffunction>
</cfcomponent>
As you can see, I added an "newusersActive" field to my NewsUsers
table as well.
-Aaron
On 2/10/06, C. Hatton Humphrey <[EMAIL PROTECTED]> wrote:
> On 2/10/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> > I have three tables: Users, NewsUsers (linking table), NewsCategories
>
> > How do I insert a new user in the user table, retrieve the newly
> > created userID and insert it into the newsUsers linking table, and
> > insert the newscatID into the newsUsers linking table as well? All of
> > this will be done with CFC's and I'm not sure If I should have a
> > seperate CFC for users and another for newsletters.
>
> What database engine are you using to run this, MSSQL, MySQL, Access
> or something else? The reason I ask is simple, some functions work in
> some engines and not on others.
>
> Hatton
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231953
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