macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: Search Based on Multiple Checkboxes

Subject: Re: Search Based on Multiple Checkboxes
From: "jerreye04"
Date: Thu, 26 Jul 2007 21:28:46 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion

Hey jmmorgan, I am not using VARCHAR. Should I?

 I am generating my checkboxes dynamically. I have two columns in my interests 
table:

 "interestID" (INT) Identity=YES
 "list " (TEXT) which stores my interests (i.e. - surfing, diving, etc)

 Here is my code to generate my checkboxes:
 ===============================================
 <cfquery name="GetInterests" datasource="#Application.dSource#" DBTYPE="ODBC">
 SELECT *
 FROM _select_interests                         
 </cfquery>     
                        
 <cfset NumberOfRecords=0>
 <cfoutput query="GetInterests">
 <cfset NumberOfRecords=NumberOfRecords+1>
 <td valign="top" width="20" height="20">
 <cfinput type="checkbox" name="interest_checkboxes" id="interest_checkboxes" 
value="#GetInterests.list#" /></td>
 <td width="170" class="mainText12">#GetInterests.list#</td>
 <cfif NumberOfRecords IS 3>                                               
 </tr>
 <tr>
 <cfset NumberOfRecords=0>
 </cfif>
 </cfoutput>

 ===============================================

 I am quite new to SQL and don't know when or why I would ever use VARCHAR. 
Does it matter? Should I set my interestID (primary key) column to VARCHAR with 
Identity=yes and set the generated checkbox NAMES (VALUES?) to this VARCHAR 
column?



<Prev in Thread] Current Thread [Next in Thread>