I want to use a query to return a random set of data.
later in the code ...
When I run this query and Access and examine the first four records, I get a different set of four every time I run it. However, my ColdFusion results are ALWAYS the same four.
What can I do differently to return a random set of "featured products"? I suspect that I run into a problem with the MAX rows in the cfquery statement, but I don't know what to do to fix it.
MrsBean
Later in my code,
Code:
<cfquery name="get_fp" datasource="this_content" MAXROWS=4>
SELECT table_text.text_client_id, table_text.text_id, table_text.text_title, table_text.text_content, table_text.text_link, Rnd([text_id]) AS random
FROM table_text
WHERE (((table_text.text_client_id)=39) AND ((table_text.text_title) Like 'Featured Product%'))
ORDER BY Rnd([text_id]) desc;
</cfquery>
Code:
<cfloop query = "get_fp" >
<a href="<cfoutput>#text_link#</cfoutput>"><img src="[URL unfurl="true"]http://www.somewebsite.com/client_images/text/<cfoutput>#text_id#</cfoutput>_1.jpg"[/URL] /></a><br />
</cfloop>
When I run this query and Access and examine the first four records, I get a different set of four every time I run it. However, my ColdFusion results are ALWAYS the same four.
What can I do differently to return a random set of "featured products"? I suspect that I run into a problem with the MAX rows in the cfquery statement, but I don't know what to do to fix it.
MrsBean
Later in my code,