What's wrong with my code here. I am trying to output two different records dynamically. I have two records in a table. I want to use the same query with a dynamic where parameter that is cfset before each query.
If my first record has a value of ONE, and my second record has a value of TWO. The code below is returning the following:
ONE
ONE
When what I am searching for is:
ONE
TWO
I need this ability because these two records are being displayed on the same page but not one under the other so one query will not do. I know I can create two queries here. What I'm trying to achieve though is a standard query that can be managed by parameters.
So "placement" 1 represents my first record in the database and "placement" 2 represents the second record. Here is the query.
If my first record has a value of ONE, and my second record has a value of TWO. The code below is returning the following:
ONE
ONE
When what I am searching for is:
ONE
TWO
I need this ability because these two records are being displayed on the same page but not one under the other so one query will not do. I know I can create two queries here. What I'm trying to achieve though is a standard query that can be managed by parameters.
Code:
<cfset placement = 1>
<cfoutput query="gettext">
#thetext#
</cfoutput>
<br/>
<cfset placement = 2>
<cfoutput query="gettext">
#thetext#
</cfoutput>
So "placement" 1 represents my first record in the database and "placement" 2 represents the second record. Here is the query.
Code:
<cfquery name="gettext" datasource="#db#">
select *
from sitetext
where webpagename = '#webpagename#' and placement = '#placement#'
</cfquery>