WHERE = field IN #listlen()#

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default WHERE = field IN #listlen()#

    I'm capturing the value of wrong answers to question, i.e. 1,2,5,7, in a LIST.
    I would like to use the LIST with the WHERE to generate the question
    incorrectly and then display the right answer. I got it to work by doing
    X-amount data queries in a loop. I don't like that solution and thought I could
    it the wasy described above. Here is the code I'm using:

    <cfquery name="question" datasource="#dataquery#>
    SELECT *
    FROM quiz
    WHERE quizID IN #listlen(answer)#
    </cfquery>

    Answer is the LIST.

    thanks
    grady


    CF_starter Guest

  2. Similar Questions and Discussions

    1. Forms: Text field - auto fill another field?
      Someone PLEASE help me... how do i structure a form so that when text is entered into one field, it auto-fills other fields on the form that are...
    2. Comparing current field data with last entry for field
      Hi. I have a form that is inserting sales data on a daily basis. I have a field named "RoundTOTAL" which is the total sales for the day rounded to...
    3. Defined text field in form -> subject field in e-mail
      Hi, I have a form on my web site which users send to me by mailto-function. I would like the text they write in a particular text field to...
    4. Linking date field to text field entry
      Is there a way to setup a date field that will automatically enter the date when any information is entered into a field next to it?
    5. Curved Field vs Flat Field projector lenses
      I was looking thru Adorama's page and came across two Kodak projector lenses. One was a 102/2.8 "Curved Lens" the other a 100/2.8 "Flat Lens" and...
  3. #2

    Default Re: WHERE = field IN #listlen()#

    ListLen(x) return the Length of the list "x".

    So if you <cfset answer = "1,2,5,7">, then you're asking "WHERE quizID IN
    (4)".

    I'm really not sure what else you're trying to do though. Are you trying to
    select the particular question, then show it with each element of the list as a
    wrong answer?

    cf_menace Guest

  4. #3

    Default Re: WHERE = field IN #listlen()#

    I'm trying to see if I can look at all the value in the list to return the answer. I have a loop that I'm using but that don't like that solution.

    grady
    CF_starter Guest

  5. #4

    Default Re: WHERE = field IN #listlen()#

    I'm trying to see if I can look at all the values in the list to return the answer. I have a loop that I'm using but that don't like that solution.

    grady
    CF_starter Guest

  6. #5

    Default Re: WHERE = field IN #listlen()#

    I'm trying to see if I can look at all the values in the list to return the answer. I have a loop that I'm using but that don't like that solution.

    grady
    forumnotifier Guest

  7. #6

    Default Re: WHERE = field IN #listlen()#

    how does quizID relate to the answer? Show us more code, especially the old loop.
    kyle969 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139