Question
Master-detail page with SQL querty
This is the hyperlink I use on my master page to link my
database to the detail page. A visitor to my site clicks on a
record entry on the master page. This causes a detail page to open
which displays further details about this record.
<td><a href="Education - Bulletin Board - Replies Table of Contents.cfm?ReplyRecordID=#DisplayTable.ID#">View replies</a></td>
The code on the detail page is:
cfparam name="PageNum_EducationForumRS" default="1">
<cfparam name="URL.ReplyRecordID" default="1">
<cfquery name="CountOfResponses" datasource="Education Forum">
SELECT ParentID, Count(ParentID) as CountOfResponses
FROM Messages
GROUP BY PARENTID
HAVING ParentID <> 0
ORDER BY ParentID DESC
</cfquery>
<cfquery name="MessagesWithResponses" datasource="Education Forum">
SELECT Messages.ID, Messages.ParentID, Messages.Subject, Messages.Author, Messages.Message, Messages.Email, Messages.Posted
FROM Messages
WHERE ParentID=#URL.ReplyRecordID#
</cfquery>
When this code runs I get the following error: "Syntax error (missing operator) in query expression". The error references the "WHERE ParentID=#URL.ReplyRecordID#" line.
The ParentID field is a numerical field. If I replace #URL.ReplyRecordID# with a numerical value the query will run.
I would be very grateful for suggestions.
<td><a href="Education - Bulletin Board - Replies Table of Contents.cfm?ReplyRecordID=#DisplayTable.ID#">View replies</a></td>
The code on the detail page is:
cfparam name="PageNum_EducationForumRS" default="1">
<cfparam name="URL.ReplyRecordID" default="1">
<cfquery name="CountOfResponses" datasource="Education Forum">
SELECT ParentID, Count(ParentID) as CountOfResponses
FROM Messages
GROUP BY PARENTID
HAVING ParentID <> 0
ORDER BY ParentID DESC
</cfquery>
<cfquery name="MessagesWithResponses" datasource="Education Forum">
SELECT Messages.ID, Messages.ParentID, Messages.Subject, Messages.Author, Messages.Message, Messages.Email, Messages.Posted
FROM Messages
WHERE ParentID=#URL.ReplyRecordID#
</cfquery>
When this code runs I get the following error: "Syntax error (missing operator) in query expression". The error references the "WHERE ParentID=#URL.ReplyRecordID#" line.
The ParentID field is a numerical field. If I replace #URL.ReplyRecordID# with a numerical value the query will run.
I would be very grateful for suggestions.
