Difference between revisions of "SQL.php"

From Organic Design wiki
(tidy up)
m
Line 4: Line 4:
 
# Get commands if admin
 
# Get commands if admin
 
if ($GLOBALS['xwIsAdmin']) {
 
if ($GLOBALS['xwIsAdmin']) {
if (xwGetProperty($properties, "xpath:$path/SQL", $sql)) {
+
if (xwGetProperty($properties, "xpath:$path/query", $query)) {
xwMessage("Attempting to execute SQL \"$sql\"");
+
xwMessage("Attempting to execute SQL query \"$query\"");
$result = $db->query($sql);
+
$result = $db->query($query);
 
# Render result rows as messages
 
# Render result rows as messages
 
while ($row = mysql_fetch_assoc($result)) {
 
while ($row = mysql_fetch_assoc($result)) {

Revision as of 01:29, 23 February 2006

<? $db =& wfGetDB( DB_MASTER );

  1. Get commands if admin

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