Multiple URL variables and cfMail
hi,
i posted on bottom of different discussion posted (passing 2 url variables) problem solved. know how pass 2 url variables, i'm having trouble putting 1 of variables use.
i'm working on page this:
http://mymindsnotright.com/discussiongenreplies.cfm?post_id=22
and i'm trying set so, when click 'post reply' link, email sent original poster , person reply clicked 'post reply' on. idea use url variables, (as you can see on page linked above) when click post reply link, user_id of person posted reply i'm replying shows in url this:
http://mymindsnotright.com/discussiongenreplies.cfm?post_id=22&user_id =4#replytest
but reason user_id in url isn't being used , instead it's using information first row in table--even though correct user_id being shown in url
here's 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") , form.mm_insertrecord eq "form1">
<cfquery datasource="mymindsnotrighttest" password="mex0wix0" username="mikewycklendt">
insert board_replies (reply_id, post_id, board_id, user_id, username, title, content, date)
values (<cfif isdefined("form.reply_id") , #form.reply_id# neq "">
<cfqueryparam value="#form.reply_id#" cfsqltype="cf_sql_numeric">
<cfelse>
null
</cfif>
, <cfif isdefined("form.post_id") , #form.post_id# neq "">
<cfqueryparam value="#form.post_id#" cfsqltype="cf_sql_numeric">
<cfelse>
null
</cfif>
, <cfif isdefined("form.board_id") , #form.board_id# neq "">
<cfqueryparam value="#form.board_id#" cfsqltype="cf_sql_numeric">
<cfelse>
null
</cfif>
, <cfif isdefined("form.user_id") , #form.user_id# neq "">
<cfqueryparam value="#form.user_id#" cfsqltype="cf_sql_numeric">
<cfelse>
null
</cfif>
, <cfif isdefined("form.username") , #form.username# neq "">
<cfqueryparam value="#form.username#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
, <cfif isdefined("form.title") , #form.title# neq "">
<cfqueryparam value="#form.title#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
, <cfif isdefined("form.content") , #form.content# neq "">
<cfqueryparam value="#form.content#" cfsqltype="cf_sql_clob" maxlength="2147483647">
<cfelse>
''
</cfif>
, <cfif isdefined("form.date") , #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
from="mikewycklendt@mymindsnotright.com"
subject="#form.username#"
server="scriptmail.intermedia.net"
>#form.username# has replied post (#rstopicinfoforemail.title#)
-------------------------------------------------
you can see reply clicking link:
http://www.mymindsnotright.com/discussiongenreplies.cfm?post_id=#form. post_id#
should send to: #rsemail.user_email#
and reply #rsemailtoreply.username# reply has 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 reply_id asc
</cfquery>
<cfquery name="rsreplyrecordcount" datasource="mymindsnotrighttest" username="mikewycklendt" password="mex0wix0">
select *
from board_replies
</cfquery>
i glanced through code let's focus on statement: "but reason user_id in url isn't being used , instead it's using information first row in table--even though correct user_id being shown in url"
when data query object without specifying row number, data first row. happening you.
More discussions in ColdFusion
adobe
Comments
Post a Comment