Checkboxes and split function

Results 1 to 3 of 3

Thread: Checkboxes and split function

  1. #1
    Join Date
    Dec 1969
    Posts
    16

    Default Checkboxes and split function

    I have a search form using checkboxes that lets the user "filter" their search parameters (e.g. Golf Clubs - can filter out by right handed or left handed clubs, by shaft type (steel, graphite or titanium), etc. There are 11 categories, all with multiple options.<BR><BR>Couple of questions: 1. My data. How should I input the data into the db when the column has multiple entries? Use a semicolon, comma or a space between entries?<BR><BR>2. On my search results form, how should the split function look? Let&#039s assume I have columns mfg, model and shaft. What would the structure look like so that I could then display the search results on a page?<BR><BR>Thanks for all the help.<BR><BR>Alan

  2. #2
    Join Date
    Dec 1969
    Posts
    236

    Default RE: Checkboxes and split function

    &#062;1. My data. How should I input the data into the db when the &#062;column has multiple entries? Use a semicolon, comma or a space &#062;between entries?<BR><BR>use whatever delimiter - ie comma, 3 commas, or whatever - you choose but be sure that it is one that is not found in any of the entries<BR><BR>&#062;2. On my search results form, how should the split function &#062;look? Let&#039s assume I have columns mfg, model and shaft. What &#062;would the structure look like so that I could then display the &#062;search results on a page?<BR><BR>&#060;variant array&#062; ar = split(dbfield, delimiter)<BR>for i=0 to ar [Step &#060;num of entries&#062;]<BR>do something for entry i<BR>do something for entry i+1<BR>do something for entry i+2<BR>next<BR><BR>hope this helps<BR><BR><BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    16

    Default RE: Checkboxes and split function

    Thanks Ryan for the reply. This is what I&#039m "going with" right now:<BR><BR>Dim strModel<BR>Dim araModel<BR>Dim intElements<BR>Dim i<BR><BR>strModel = request("Model")<BR>araModel = split(strModel, ",")<BR>intElements = ubound(araModel)<BR>For i = 0 to intElements<BR>strModel = araModel(i)<BR> If sWhere = "" Then<BR> sWhere = "(Model = &#039" & Model & "&#039)"<BR> Else<BR> sWhere = sWhere & " AND (Model = &#039" & Model & "&#039)"<BR> End If<BR>Next<BR><BR>sSQL = "SELECT * FROM GolfEquipment"<BR>If sWhere &#060;&#062; "" Then<BR> sSQL = sSQL & " WHERE (" & sWhere & ")"<BR>sSQL = sSQL & " ORDER BY CompanyName DESC"<BR>End If<BR><BR>I have 11 categories, so the above Model would be 11 different categores with multiple checkboxes. This is my SQL/search output:<BR><BR>SELECT * FROM Company WHERE ((Model = &#039&#039) AND (Model = &#039&#039)) ORDER BY CompanyName DESC<BR><BR>As you can see, the Model = &#039&#039 has no content. Any help/suggestions gladly welcome!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •