Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

Multiple URL variables and cfMail

$
0
0

Hi,

 

I posted this on the bottom of a different discussion I posted (Passing two URL variables) where my problem was solved.  But now that I know how to pass two URL variables, I'm having trouble putting one of those variables to use.

 

I'm working on a page like this:

     http://mymindsnotright.com/discussionGenReplies.cfm?post_id=22

 

and i'm trying to set it up so, when I click a 'post reply' link, an email is sent to the original poster and the person whose reply you clicked 'post reply' on.  The idea was to use URL variables, so (as you  can see on the page i linked above) when I click a post reply link, the user_id of the person who posted the reply that i'm replying to shows up in the URL like this:

     http://mymindsnotright.com/discussionGenReplies.cfm?post_id=22&user_id =4#replytest

 

but for some reason the user_id in the URL isn't being used and instead it's just using the information from the first row in the table--even though the correct user_id is being shown in the URL

 

Here's what I'm working with:

====================================================================

<cfparam name="URL.post_id" default="1">

<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>

<cfparam name="URL.user_id" default="1">

<cfparam name="FORM.post_id" default="1">

<cfquery name="rsGenPost" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM boardtopics

WHERE post_id = <cfqueryparam value="#URL.post_id#" cfsqltype="cf_sql_numeric">

</cfquery>

<cfquery name="rsTopicInfoForEmail" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM boardtopics

WHERE post_id = <cfqueryparam value="#FORM.post_id#" cfsqltype="cf_sql_numeric">

</cfquery>

<cfquery name="rsReplyToReplyEmail" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM user_accounts

WHERE user_id = <cfqueryparam value="#URL.user_id#" cfsqltype="cf_sql_numeric">

</cfquery>

 

 

 

 

 

 

<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">

  <cfquery datasource="mymindsnotrighttest" password="Mex0Wix0" username="mikewycklendt">

  INSERT INTO board_replies (reply_id, post_id, board_id, user_id, username, title, content, date)

VALUES (<cfif IsDefined("FORM.reply_id") AND #FORM.reply_id# NEQ "">

<cfqueryparam value="#FORM.reply_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.post_id") AND #FORM.post_id# NEQ "">

<cfqueryparam value="#FORM.post_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.board_id") AND #FORM.board_id# NEQ "">

<cfqueryparam value="#FORM.board_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.user_id") AND #FORM.user_id# NEQ "">

<cfqueryparam value="#FORM.user_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.username") AND #FORM.username# NEQ "">

<cfqueryparam value="#FORM.username#" cfsqltype="cf_sql_clob" maxlength="65535">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.title") AND #FORM.title# NEQ "">

<cfqueryparam value="#FORM.title#" cfsqltype="cf_sql_clob" maxlength="65535">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.content") AND #FORM.content# NEQ "">

<cfqueryparam value="#FORM.content#" cfsqltype="cf_sql_clob" maxlength="2147483647">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">

<cfqueryparam value="#FORM.date#" cfsqltype="cf_sql_timestamp">

<cfelse>

NULL

</cfif>

)

<cfquery name="rsEmail" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM user_accounts

WHERE user_id = <cfoutput>#rsTopicInfoForEmail.user_id#</cfoutput>

</cfquery>

 

 

<cfquery name="rsEmailtoReply" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM user_accounts

WHERE user_id = <cfoutput>#rsReplyToReplyEmail.user_id#</cfoutput>

</cfquery>

 

 

<cfmail

        TO="mikewycklendt@gmail.com"

        from="mikewycklendt@mymindsnotright.com"

        subject="#FORM.username#"

        server="scriptmail.intermedia.net"

        >#FORM.username# has replied to your post (#rsTopicInfoForEmail.title#)

-------------------------------------------------

 

 

You can see the reply by clicking this link:

http://www.mymindsnotright.com/discussionGenReplies.cfm?post_id=#FORM. post_id#

 

should send to:  #rsEmail.user_email#

and a reply to #rsEmailToReply.username# reply who has the email:

#rsEmailToReply.user_email#

 

  </cfmail>

 

 

 

 

 

 

 

 

 

 

 

 

  </cfquery>

  <cflocation url="discussionGenReplies.cfm?post_id=#FORM.post_id#">

</cfif>

 

 

<cfquery name="rsGenReplies" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM board_replies

WHERE post_id = <cfqueryparam value="#URL.post_id#" cfsqltype="cf_sql_numeric">

ORDER BY reply_id ASC

</cfquery>

<cfquery name="rsReplyRecordCount" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM board_replies

</cfquery>


Viewing all articles
Browse latest Browse all 238792

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>