$stmt = $modx->query(...);
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo $row['field1'].' '.$row['field2']; //etc...
}<?php
$html= (int) $modx->getOption('html', $scriptProperties, 0);
$twmg_base = $modx->getOption('core_path').'components/twmg/';
include_once($twmg_base.'model/property/propertypurge.class.php');
$property = new propertypurge();
$_config = array(
'parent' => 63,
'template' => 20,
'move_image' => true,
'xml_folder' => MODX_BASE_PATH.'xml/',
'xml_success_folder' => MODX_BASE_PATH.'xml/processed/',
'image_folder' => MODX_BASE_PATH.'assets/images/properties/'
);
$property->initiliaze($_config);
$property->run();
$property->printMessage($html);<?php
// ==========================================================================
// Update Log
// Date Init Ver Description
// --------------------------------------------------------------------------
class propertyPurge {
var $image_folder = 'assets/images/properties/';
// var $debug = false;
var $debug = true;
var $messages = array();
function initiliaze($config=array())
{
foreach ($config as $key=>$value)
{
$this->$key = $value;
}
}
function run()
{
if ($this->debug){ $this->logMessage('Debug: function run()', "");}
$output = '';
$row = '';
$sql = "SELECT * FROM vjraycom_db.vj_site_tmplvar_contentvalues";
if ($this->debug){ $this->logMessage('Debug: function run() Sql=', $sql);}
while($row = $sql->fetch(PDO::FETCH_ASSOC))
{
$ouptut = $row['id']."\t".$row['tmplvarid'];
if ($this->debug){ $this->logMessage('Debug: function run() Output=', $output);}
}
if ($this->debug){ $this->logMessage('Debug: End function run()', "");}
}
function logMessage($item, $message)
{
$this->messages[] = array(
'item' => $item,
'message' => $message
);
}
function printMessage($html=true)
{
if ($this->debug){ $this->logMessage('Debug: function printMessage()', "");}
$output = '';
foreach ($this->messages as $msg) {
if($html)
$output .= '<p>'.$msg['item'].' '.$msg['message'].'</p>';
else
$output .= $msg['item'].' '.$msg['message']."\n";
}
echo $output;
if ($this->debug){ $this->logMessage('Debug: End function printMessage()', "");}
}
}function run()
{
if ($this->debug){ $this->logMessage('Debug: function run()', "");}
$output = '';
$row = '';
$result = '';
$result = $modx->query("SELECT * FROM vjray_modx.modx_users WHERE id=1");
if (!is_object($result))
{
if ($this->debug){ $this->logMessage('Debug: function run()SQL Result= Row', "No Result");}
}
else
{
$row = $result->fetch(PDO::FETCH_ASSOC);
if ($this->debug){ $this->logMessage('Debug: function run()SQL Result Row=', $row);}
}
if ($this->debug){ $this->logMessage('Debug: End function run()', "");}
}global $modx;
$this->modx