We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    I was trying to find a way to pass variables to queries using an @SELECT binding and could not. I took a look at the current code for @SELECT and wondered if we could change the {DBASE} and {PREFIX} tags to placeholder style, and then execute the mergePlaceholderContent on the param. What do you think?

    			case "@SELECT":		// selects a record from the cms database
    				$rt = array();
    				$replacementVars= array(
    					'DBASE'=> $modx->db->config['dbase'],
    					'TABLE_PREFIX'=> $modx->db->config['table_prefix']
    				);
    				foreach($replacementVars as $key=> $value) {
    					$modx->setPlaceholder($key, $value);
    				}
    				$param = $modx->mergePlaceholderContent($param); 
    				$rs = $modx->db->query("SELECT $param;");
    				$output = $rs;
    				break;
      • 32963
      • 1,732 Posts
      Hi Jason,

      We sure can
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.