We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    I'm in the process of trying to execute a simple query to data saved from the Tagger component, but am not able to get it to work:
    $c = $modx->newQuery('TaggerTagResource',array('resource'=>$landing_id));
    $c->select('TaggerTagResource.tag');
    $c->leftJoin('TaggerTag','TaggerTag','TaggerTag.id = TaggerTagResource.tag');
    $c->where(array(
    	'TaggerTag.group'=>$match_tag_group_id
    ));
    $c->limit(1);
    $tag = $modx->getCollection('TaggerTagResource',$c);
    

    The issue seems to stem from the select column: When it is simply 'tag' the query is built, but ultimately fails because both tables have a 'tag' column; when it is as shown above, the script simply crashes. I'm guessing I'm missing something obvious ... any ideas?
      • 3749
      • 24,544 Posts
      Try this:

      $c->select('TaggerTagResource.tag', 'TaggerTag.id', 'TaggerTag.group' );
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting