SQL.php

From Organic Design wiki
Revision as of 07:32, 8 August 2005 by Nad (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<?

if ($event == 'data') {

# Get an instance of wiki's DB object $db =& wfGetDB( DB_MASTER );

# Get commands if admin if ($GLOBALS['xwIsAdmin']) { if (xwGetProperty($properties, "xpath:$path/SQL", $sql)) { xwMessage("Attempting to execute SQL \"$sql\""); $result = $db->query($sql); # Render result rows as messages while ($row = mysql_fetch_assoc($result)) { $msg = ; foreach ($row as $k => $v) $msg .= "$k = $v, "; xwMessage($msg,'red'); }

} }

# Get filters from properties if (!xwGetProperty($properties, "$path/max", $max)) $max = ; if (!xwGetProperty($properties, "$path/filter", $filter)) $filter = ;

# Get filtered content from database

  1. $result = $db->query("SHOW TABLES;");

# Render rows into article

  1. while ($row = mysql_fetch_assoc($result)) {
  2. $article .= "\n*";
  3. foreach ($row as $k => $v) $article .= "$k=$v, ";
  4. }

}

elseif ($event == 'view') {

# Get reports from properties if (!xwGetProperty($properties, "$path/report", $report)) $report = ;

}


?>