Populating cookies from a SQL Query
I have a SQL query that I know for a fact will produce 4 records without fail
What I need to do is to store the data on an individual basis so that I can use each record independantly on the following page allowing me to set up hyperlinks based on each one including it's text description (from the query - cat_tiitle , and it's uid from the query, cat_uid)
I have written some code but it seems a little primative, I am thinking that there might be a better way to do this? I know it's only a small piece of code but it has the potential to be used a LOT so I need to make sure I have this as efficient as possible -->
<!--- GET THE 4 RECORDS --->
<CFQUERY NAME="GetCategories" DATASOURCE="#datasource#">
SELECT cat_uid,cat_title
FROM categories
WHERE cat_uid IN (#valuelist(Validateinstall.install_preferences)#)
ORDER by cat_title
</CFQUERY>
<!--- SET UP 4 INDIVIDUAL COOKIES WHICH HAVE THE UID AND THE TITLE --->
<CFLOOP query="GetCategories">
<CFCOOKIE NAME="pref_uid_#GetCategories.CurrentRow#" value="#GetCategories.cat_uid#">
<CFCOOKIE NAME="pref_title_#GetCategories.CurrentRow#" value="#GetCategories.cat_title#">
</CFLOOP>
<!--- DISPLAY THE 4 HYPERLINKS --->
<CFOUTPUT>
1. <a href="cat.cfm?cat_uid=#cookie.pref_uid_1#,#URLEncodedFormat(cookie.pref_title_1)#"
class="reg_text">#cookie.pref_title_1#</a>
2. <a href="cat.cfm?cat_uid=#cookie.pref_uid_2#,#URLEncodedFormat(cookie.pref_title_2)#"
class="reg_text">#cookie.pref_title_2#</a>
3. <a href="cat.cfm?cat_uid=#cookie.pref_uid_1#,#URLEncodedFormat(cookie.pref_title_3)#"
class="reg_text">#cookie.pref_title_3#</a>
4. <a href="cat.cfm?cat_uid=#cookie.pref_uid_4#,#URLEncodedFormat(cookie.pref_title_4)#"
class="reg_text">#cookie.pref_title_4#</a>
</CFOUTPUT>
Appreciate any thoughts on making this more efficient
Thanks
Mark
