4 Replies Latest reply on Apr 24, 2007 4:08 PM by gill1723

    RandRange

    gill1723 Level 1
      can you capture a random range question from a database and save it. Example I am querying my database for all the question which is 3, than I use the randrange to randomly display 1 question on the screen. Can I hold that random question somehow so when a user answer the question and it's wrong I can send them back to the same page with the same question. not a new question from the database.
        • 1. Re: RandRange
          jdeline Level 1
          Use a hidden field to hold the random question when you return to ask the question again. On the question page, use <CFPARAM NAME="question" DEFAULT=""> at the top of the page. Then test to see if question is null. If so, do the RandRange( ). If not, ask the same question again from the hidden field.
          • 2. Re: RandRange
            gill1723 Level 1
            if I capture the question in a hidden field, and the answer the user provides is wrong what will stop it from displaying another question if I send them back to the questions page? I am very new at this.
            • 3. RandRange
              jdeline Level 1
              The code below should give you an idea how to proceed. It returns the question in the URL rather than a hidden field.
              • 4. Re: RandRange
                gill1723 Level 1
                here is my query, how would I set this up to work with your script
                select q.question, I.*
                from swa.IdentityQuestions q, swa.IdentityAnswers I
                where q.IdentityQuestionId = I.IdentityQuestionId
                and userId = '1000'