Skip to main content
Known Participant
August 11, 2008
Answered

Output issue while grouping

  • August 11, 2008
  • 17 replies
  • 2544 views
OK guys... I have written a dynamic hierarchial menu that uses CSS. My issue is that I have 6 main menu items and each item has submenus. I have it ready to go in theory, but my cfoutput keeps repopulating the first entry.


I am hoping someone can help ASAP. I have 6 of the same thing.

JG
    This topic has been closed for replies.
    Correct answer -__cfSearching__-
    jgethers wrote:
    > It works well, except it doesnt output 2 3 4 5 6.

    It never retrieves them in the first place. That is the problem, not the output.

    Are there actually pagecontent records for parentID values 2, 3, 4, 5 and/or 6? If not, those those menu items will not appear in the results because you are using an INNER JOIN.

    Try changing the INNER JOIN to a LEFT JOIN. That will include all records from the left hand table (ie cssmenu) even if there are no matching records in pagecontent .

    If that does not help, run a select on both tables separately and cfdump the results of the two queries.

    17 replies

    jgethersAuthor
    Known Participant
    August 11, 2008
    http://odcinc.com/new/menu.cfm

    That is where the cfdump is. It is only matching up mID 1
    I have more in there like the number 2 has 1 child object.

    So here is the deal. I have the 2 tables. 1 table has 6 items . These are the parent menus

    The second table has the parentID field. This table also houses content for that page and the page name.

    Sorry this took so long. It is hard to write code from my blackberry while installing servers.

    John
    jgethersAuthor
    Known Participant
    August 11, 2008
    I am using the query you wrote.
    <cfquery name="populatemenu" datasource="#DSN#">
    SELECT cssmenu.mID,
    pagecontent.parentID,
    pagecontent.pname,
    pagecontent.plink
    FROM cssmenu
    INNER JOIN pagecontent
    ON cssmenu.mID = pagecontent.parentID
    ORDER BY cssmenu.mID, pagecontent.parentID
    </cfquery>
    Inspiring
    August 11, 2008
    I meant the query returned from the cfquery call:- populatemenu, what does populatemenu contain. So I wold like to see the rows and columns and what data they have in them?
    Inspiring
    August 11, 2008
    jgethers wrote:
    > I am using the query you wrote....

    Cfdump the query on your page so Stressed_Simon can see the results

    <!--- Your page: http://www.odcinc.com/new --->

    <!--- run the query --->
    <cfquery name="populatemenu" datasource="#DSN#">
    .... your query ....
    </cfquery>

    <!--- dump the results --->
    <cfdump var="#populatemenu#">

    jgethersAuthor
    Known Participant
    August 11, 2008
    I was trying to do it from the 1 query
    Inspiring
    August 11, 2008
    I know that. But you know what the data in the query is and I don't which is the missing piece of the puzzle I need to help you.
    jgethersAuthor
    Known Participant
    August 11, 2008
    I have 6 buttons across the top. It is only populating mID =1 there should be 5 more with menus
    Inspiring
    August 11, 2008
    Can you dump that query somewhere so I can see it?
    jgethersAuthor
    Known Participant
    August 11, 2008
    No you dont. I was working on the web server. Try it again.
    Inspiring
    August 11, 2008
    When I hover over Employment I get 6?

    assembly, bindery, mailings, inspection, vinyl, cheeseliners
    jgethersAuthor
    Known Participant
    August 11, 2008
    Simon now instead of the 6 I had before, I get 1

    http://www.odcinc.com/new
    Inspiring
    August 11, 2008
    Apparently I need to be authenticated to access that page, and without knowing what the data returned by the query looks like I cannot really help you further!
    Inspiring
    August 11, 2008
    cfoutput has a group attribute. Usage is described in the cfml reference manual. If you don't have one, the internet does.
    jgethersAuthor
    Known Participant
    August 11, 2008
    Yeah... I tried that. <cfoutput query="populatemenu" group="mID"> (and tried cssmenu.mID)

    Same thing.
    Inspiring
    August 11, 2008
    Your approach is all wrong. You put the group on the outer cfoutput. Then you put another cfoutput nested inside for the children. I think what I have done here will work?