How do I get the query results into a variable then output those results from the variable onto the next page, Here is what I am currently using:
<cfquery name="findIt" datasource="myDB">
SELECT city,state
FROM myTable
WHERE state='#form.state#' or city='#form.search#' or zip='#form.search#'
GROUP BY city, state
ORDER BY city
</cfquery>
<cflock TIMEOUT="30" NAME="#Session.SessionID#">
<cfset session.query_results=session.findIt>
</cflock>
***Later in the page
<cfoutput query="session.findIt">
<li><a a href=" </cfoutput>
This prints a list of cities on the page. I want to be able to click on a city to list the business' in that particular city while keeping the list of cities that was populated by the query results to remain the same and reprint in a list on the following page.
Page 2
<cflock timeout="30" NAME="#Session.SessionID#" TYPE="ReadOnly">
<cfoutput>
<li><a href=" </cfoutput>
</cflock>
This last bit of code prints on my page findIt rather then what is stored on the variable named findIt
Am I not unserstanding how to set the session variable???
Calista gave me an answer but still not understanding how to actually use the variable with the stored query results later on.
<cfquery name="findIt" datasource="myDB">
SELECT city,state
FROM myTable
WHERE state='#form.state#' or city='#form.search#' or zip='#form.search#'
GROUP BY city, state
ORDER BY city
</cfquery>
<cflock TIMEOUT="30" NAME="#Session.SessionID#">
<cfset session.query_results=session.findIt>
</cflock>
***Later in the page
<cfoutput query="session.findIt">
<li><a a href=" </cfoutput>
This prints a list of cities on the page. I want to be able to click on a city to list the business' in that particular city while keeping the list of cities that was populated by the query results to remain the same and reprint in a list on the following page.
Page 2
<cflock timeout="30" NAME="#Session.SessionID#" TYPE="ReadOnly">
<cfoutput>
<li><a href=" </cfoutput>
</cflock>
This last bit of code prints on my page findIt rather then what is stored on the variable named findIt
Am I not unserstanding how to set the session variable???
Calista gave me an answer but still not understanding how to actually use the variable with the stored query results later on.