Difference between revisions of "SQL.php"
From Organic Design wiki
(tidy up) |
|||
| Line 1: | Line 1: | ||
<? | <? | ||
| + | $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'); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
?> | ?> | ||
Revision as of 01:27, 23 February 2006
<? $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'); } } } ?>



