ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

query hanging tag weirdness

August 01, 2007 4:23pm

Subscribe [1]
  • #1 / Aug 01, 2007 4:23pm

    saul

    6 posts

    Howdy;

    I’m trying to crawl up a category tree using the query sql - and I’ve run into a issue I just can’t get a grasp of
    here’s the code
    ——code——

    {exp:query sql="SELECT parent_id AS myMomIndex FROM exp_categories WHERE cat_id = {last_index}"}
        <?         
        $iam ='{last_segment}';
            $mom = '{myMomIndex}';
        ?>         
    
    {exp:query sql="SELECT parent_id AS myGrandMom, cat_name AS mommyName FROM exp_categories WHERE cat_id = {myMomIndex}"} 
        <?
        $momName ='{mommyName}';    
        $grandmom = '{myGrandMom}';
        ?>
        
    {exp:query sql="SELECT cat_name AS greatGrandMomName, parent_id AS greatGrandMom FROM exp_categories WHERE cat_id = {myGrandMom}"} 
        <?
        $grandmomName = '{greatGrandMomName}';
        ?>
    {/exp:query}
    {/exp:query}
    {/exp:query}

    ——code——
    now as convoluted as that may looks, it works, all those variables get set or remain/return 0 if a given category doesn’t have two levels of hierarchy - but here’s the weird thing - if I go up to a category that is at a top level (no mom / no grandmom is this concept) the third query doesn’t just fail - it actually drops its ‘{/exp:query}’ closing tag on the page.. I’ve tried all manners of wrapping the second and third queries in a conditional (both EE and PHP conditionals) and it still seems to fire off…

    any help would be greatly appreciated—I’m baffled..

  • #2 / Aug 01, 2007 4:53pm

    Derek Jones

    7561 posts

    Please do not duplicate posts across forums.  I am closing this thread; please leave the discussion in your first topic, which is already in the appropriate place.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases