How to read from 2 queries

Discussion in 'Programming' started by youjie, Nov 6, 2006.

  1. #1
    May i know how to read from 2 queries?

    For example, I have use

    <cfoutput query="FindCountry">
    <cfoutput query="FindNationality">
    The country is #FindCountry.id#
    The nationality is #FindNationality.id#
    </cfoutput>
    </cfoutput>

    I was prompted an error when i do this.

    Thanks
     
    youjie, Nov 6, 2006 IP
  2. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Get rid of the second <cfoutput>. Why because you are already 'outputting'. You only now need to loop. Hence your code should instead be:
    <cfoutput query="FindCountry">
    <cfloop query="FindNationality">
    The country is #FindCountry.id# and
    The nationality is #FindNationality.id# <br />
    </cfloop>
    </cfoutput>

    Hope I helped

    DaTropics!
     
    datropics, Nov 6, 2006 IP
  3. websiteideas

    websiteideas Well-Known Member

    Messages:
    1,406
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #3
    What if you wanted to loop through both of the queries?
     
    websiteideas, Nov 23, 2006 IP
  4. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    with the code above, you already are. What are you trying to do?
     
    datropics, Nov 24, 2006 IP