• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

passing two URL variables

Explorer ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

Hi,

I'm working on a page like this:

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

and am trying to make it so the link for each "Post Reply" link (save for the "Post Reply" link below the main topic) adds another url variable after the post_id variable.  The new variable I want to add would be the "user_id" for each reply, so each "Post Reply" link is specific to the person who posted the reply...

basically, I want it to look like this after lcikcing one of the "Post Reply" link

http://mymindsnotright.com/discussionGenReplies.cfm?post_id=22&user_id=(the user id of the person who posted the reply)#replytest 

               (the link doesn't go to a new page but rather to a named anchor lower down on the page)

The closest I can get is with this:

<a href="?post_id=<cfoutput>#rsGenPost.post_id#</cfoutput>&user_id=<cfoutput>#rsGenReplies.user_id#</cfoutput>##replytest" class="redlink"><strong>Post Reply</strong></a>

but when I click that link, I get this:

http://localhost:8500/Htdocs/discussionGenReplies.cfm?post_id=1010101010101010&user_id=23411111#repl...

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

@wycks,

Not sure why the post_id is outputting twice, but that code can be cleaned up a bit.  Remove the inner </cfoutput> and <cfoutput> tags so it looks more like this:

<a href="?post_id=<cfoutput>#rsGenPost.post_id#&user_id=#rsGenReplies.user_id#</cfoutput>##replytest" class="redlink"><strong>Post Reply</strong></a>

I am assuming rsGenPost is a query?  If so, are there multiple rows returned in that query (that may have the same post_id value repeated)?

-Carl V.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

No, there is only one post_id for each row.

But there are multiple rows with the same user_id... is that going to be a problem?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

Maybe it would help to see more of your code, including the queries, and especially whatever surrounds the line you referenced in your original post.

-Carl V.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

I often find it neater to place the cfoutput tag outside double quotes, like this:

<cfoutput><a href="?post_id=#rsGenPost.post_id#&user_id=#rsGenReplies.user_id###replytest" class="redlink"></cfoutput><strong>Post Reply</strong></a>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 27, 2012 Nov 27, 2012

Copy link to clipboard

Copied

I was going to recommend that instead of what I posted, but didn't want to have to get into explaining escaping the hash/pound symbols that weren't part of the variable outputs.  Oh well...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

Thanks for the responses.

I changed the link to:

     <cfoutput><a href="?post_id=#rsGenPost.post_id#&user_id=#rsGenReplies.user_id###replytest" class="redlink"></cfoutput><strong>Post Reply</strong></a>

and get back this (after clicking a 'post reply' link)

     http://localhost:8500/Htdocs/discussionGenReplies.cfm?post_id=10&user_id=1#replytest

So, for each reply link, the only user_id I get is "1".  Before changing the link, I got every user_id for a user who posted a reply--now I only get the first one.

This is the code for the page I'm working on.

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

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

<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>

<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>

<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>

<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#

     </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>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

          <title>My Minds Not Right -- General Discussion : <cfoutput>#rsGenPost.title#</cfoutput></title>

          <link rel="stylesheet" type="text/css" href="HTML/style.css">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style type="text/css">

.blogcontent {

          font-size: 11pt;

          font-family: Tahoma, Geneva, sans-serif;

}

.comments {

          font-family: Tahoma, Geneva, sans-serif;

          font-size: 12px;

          font-weight: bold;

          text-decoration: underline;

          text-align: right;

          color: #246494;

}

.FeaturedBlogList {

          font-family: Tahoma, Geneva, sans-serif;

          font-size: 11px;

}

.FeaturedBlogListHeader {

          font-family: Tahoma, Geneva, sans-serif;

          font-size: 12px;

          font-weight: bold;

          color: #246494;

          /* [disabled]border-bottom-style: solid; */

}

.blogdate {

          font-size: 9pt;

          font-style: italic;

          font-family: Tahoma, Geneva, sans-serif;

}

.bloguserandwho {

          font-size: 10pt;

          font-style: normal;

          font-family: Tahoma, Geneva, sans-serif;

}

.redlink {

          font-family: Tahoma, Geneva, sans-serif;

          color: #F00;

          font-size: 10pt;

}

.blogtitle {

          font-size: 16px;

          font-weight: bold;

          font-family: Tahoma, Geneva, sans-serif;

          color: #246494;

}

.quoteStyle {

          font-family: Verdana, Geneva, sans-serif;

          font-size: 11pt;

          font-style: italic;

          color: #000;

}

.justified {

          text-align: justify;

}

</style>

<script type="text/javascript">

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p=new Image; d.MM_p[j++].src=a;}}

}

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms;

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

</script>

</head>

<body bgcolor="#ffffff" leftmargin=0 topmargin=0 marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/about_invert.jpg','images/discussion_invert.jpg','images/family_invert.jpg','images/askquestion_invert.jpg','images/newsletters_invert.jpg','images/home_invert.jpg')">

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">

  <tr>

    <td width="50%" background="images/bg.gif" valign="top"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

          <td valign="top" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0">

    </td>

          <td valign="top">

      <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>

          <td width="780"></td>

          <td width="100%">

            <table width="780" border="0" cellspacing="0" cellpadding="0">

              <tr>

                <td><img src="images/logo01new.jpg" width="510" height="126"><img src="images/logo02clean.jpg" width="270" height="126" border="0"></td>

              </tr>

              <tr>

                <cfinclude template="topBar.cfm">

              </tr>

            </table>

          </td>

        </tr>

      </table>

      <cfinclude template="sideBar.cfm">

<p class="left"><cfinclude template="includes/sidebarLinks.cfm">

  <br>

</p>

<!-- /left -->

          </td>

          <td rowspan="2" width="100%">

            <table border="0" cellspacing="0" cellpadding="0" width="100%">

              <tr>

                <td background="images/fon_right.gif"><img src="images/BARS/GENERALDISCUSSIONTOPIC.jpg" width="323" height="35" alt="" border="0"></td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

                <td background="images/fon_right.gif"> </td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

                <td valign="top" rowspan="2" width="100%">

                  <table width="100%" border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td width="2"><img src="images/2_f_2.gif" width="2" height="35"></td>

                      <td background="images/2_f_2_fon.gif" width="100%"><img src="images/topend.jpg" width="28" height="36"></td>

                    </tr>

                  </table></td>

              </tr>

              <tr valign="top">

                <td background="images/fon01.gif" style="background-position: top; background-repeat: repeat-x; font-size: 9px; font-family: Tahoma, Geneva, sans-serif; color: #000;"><table border="0" cellspacing="0" cellpadding="0" width="90%" background="" align="center">

                    <tr valign="top">

                      <td align="left"><h6> </h6>

                        <table width="95%" border="0">

                          <tr>

                            <td width="66%" align="left" class="FeaturedBlogListHeader">posted by: <span class="redlink"><a href="userProfile.cfm?user_id=<cfoutput>#rsGenPost.user_id#</cfoutput>"><cfoutput>#rsGenPost.username#</cfoutput></a><br>

                            </span><cfoutput>#LSDateFormat(rsGenPost.date,'M/DD/YY')#</cfoutput><span class="redlink"><cfoutput><span class="blogdate"></span></cfoutput></span></td>

                            <td width="34%" align="right"><span class="blogtitle"><a href="discussionGeneral.cfm?board_id=1">General Discussion</a></span></td>

                          </tr>

                          <tr>

                            <td colspan="2"><hr class="blogtitle"></td>

                          </tr>

                          <tr>

                            <td colspan="2"><cfoutput>

                              <p class="blogtitle">#rsGenPost.title#</p>

                            </cfoutput></td>

                          </tr>

                          <tr>

                            <td colspan="2" align="right"><cfoutput></cfoutput></td>

                          </tr>

                          <tr>

                            <td colspan="2"><cfoutput>#ParagraphFormat(rsGenPost.content)#</cfoutput></td>

                          </tr>

                          <tr>

                            <td colspan="2"><hr class="blogtitle"></td>

                          </tr>

                          <tr>

                            <td colspan="2" align="right"><a href="#replytest" class="redlink"><strong>Post Reply</strong></a></td>

                          </tr>

                        </table>

                        <p class="blogtitle"> </p>

                        <table width="95%" border="0">

                          <tr>

                            <td align="right" class="blogtitle">Replies (<cfoutput>#rsGenReplies.RecordCount#</cfoutput>)</td>

                          </tr>

                        </table>

                        <br>

                        <cfoutput query="rsGenReplies">

                          <table width="95%" border="0" cellpadding="4" cellspacing="0">

                            <tr>

                              <td width="78%" bgcolor="##DADADA"><strong><span class="blogcontent">#rsGenReplies.title#</span></strong></td>

                              <td width="22%" align="right" bgcolor="##DADADA"><span class="FeaturedBlogListHeader"><a href="userProfile.cfm?user_id=#rsGenPost.user_id#">#rsGenReplies.username#</a></span></td>

                            </tr>

                            <tr>

                              <td colspan="2" align="right"><span class="blogdate">#LSDateFormat(rsGenReplies.date,'M/DD/YY')#</span></td>

                            </tr>

                            <tr>

                              <td colspan="2" align="right"></td>

                            </tr>

                            <tr>

                              <td colspan="2" class="bloguserandwho">#ParagraphFormat(rsGenReplies.content)#</td>

                            </tr>

                            <tr>

<td colspan="2" align="right"><a href="##replytest" class="redlink"><strong><span class="bloguserandwho"></span></strong></a>

<cfoutput><a href="?post_id=#rsGenPost.post_id#&user_id=#rsGenReplies.user_id###replytest" class="redlink"></cfoutput><strong>Post Reply</strong></a>

</td>

                            </tr>

                            <tr>

                              <td colspan="2" align="right"> </td>

                            </tr>

                          </table>

                        </cfoutput>

<p class="bloguserandwho"> </p>

<p class="bloguserandwho"> </p>

<p class="bloguserandwho"> </p>

<p class="blogtitle"> </p></td>

                    </tr>

                  </table>

                </td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

                <td background="images/fon01.gif" style="background-position: top; background-repeat: repeat-x;">

                  <br></td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

              </tr>

              <tr>

                <td background="images/fon02.gif" colspan="3"><img src="images/BARS/POSTNEWREPLY.jpg" width="563" height="43" alt="" border="0"></td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

                <td background="images/fon_right.gif" width="100%"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

              </tr>

              <tr>

                <td colspan="3" align="left" valign="top"><blockquote>

                 

                  <a name="replytest" id="replytest"></a>

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                  <cfinclude template="discussionGenRepliesFORMinclude.cfm">

                 

                 

                          

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                  <p> </p>

<p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                  <p> </p>

                </blockquote>

                <p> </p>

                <p> </p>

                <p> </p>

                <p> </p></td>

                <td bgcolor="#B9B9B9"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

                <td>

                  <div align="left"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></div>

                </td>

              </tr>

            </table>

      </td>

        </tr>

        <tr bgcolor="#246494">

          <td valign="bottom">

            <table border="0" cellspacing="0" cellpadding="0" width="188" height="67" background="images/left_bot.gif">

              <tr>

                <td valign="bottom">

                  <p class="left" style="margin-bottom: 0px; margin-left: 20px;">Copyright

                    &copy;2010<br>

                    MyMindsNotRight.com<br>

                    All rights reserved</p>

                </td>

              </tr>

            </table>

          </td>

        </tr>

      </table>

      <table border="0" cellspacing="0" cellpadding="0" width="100%" height="77" background="images/fon_bot.gif">

        <tr>

          <td valign="top" width="780">

            <cfinclude template="bottomBar.cfm">

          </td>

          <td><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

        </tr>

        <tr>

          <td><img src="images/px1.gif" width="780" height="1" alt="" border="0"></td>

          <td><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

        </tr>

      </table>

    </td>

          <td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td>

          <td width="50%" background="images/bg.gif" valign="top"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>

</tr>

</table>

</body>

</html>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

Actually, I just realized that I've got another problem that (I think) relates directly to the problem I'm having with the 'post reply' link.  When I click on a username on one of the replies, it's supposed to go to the user who posted the reply's profile.  Right now, it's going to the profile of the person who made the original topic/post and not the person who made the reply.  I think that's why the change you suggested to the link

<cfoutput><a href="?post_id=#rsGenPost.post_id#&user_id=#rsGenReplies.user_id###replytest" class="redlink"></cfoutput><strong>Post Reply</strong></a>

is giving me the wrong user_id.  The user_id that shows up in the URL after clicking 'post reply' is the user_id of the original poster--not the one who made the reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

Users log in to your site. It is therefore a simple matter to obtain the user_id of the current user. You know who the current user is. For example, getAuthUser(). If necessary, you can run a query to find the corresponding user_id.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

Ok, so I figured out what was wrong with the username link that should send me to the user who posted the reply's profile.  I tried a similar thing with the 'post reply' link and this is what kind of works:

     <a href="discussionGenReplies.cfm?user_id=#rsGenReplies.user_id#" class="redlink"><strong>Post Reply</strong></a>

but when I try to take it a step further with this:

     <a href="discussionGenReplies.cfm?post_id=#rsGenReplies.post_id#&#user_id=#rsGenReplies.user_id#" class="redlink"><strong>Post Reply</strong></a>

I get an error: 

Invalid CFML construct found on line 294 at column 74.

ColdFusion was looking at the following text:

=

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

wycks wrote:

... when I try to take it a step further with this:

     <a href="discussionGenReplies.cfm?post_id=#rsGenReplies.post_id#&#user_i d=#rsGenReplies.user_id#" class="redlink"><strong>Post Reply</strong></a>

I get an error: 

Invalid CFML construct found on line 294 at column 74.

ColdFusion was looking at the following text:

=

There is an extraneous # just before user_id.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2012 Nov 29, 2012

Copy link to clipboard

Copied

LATEST

Thanks for the help.  That was an easy fix, but now I have a new problem.  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 first entry in the table.

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation