Difference between revisions of "SQL.php"
From Organic Design wiki
m |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<? | <? | ||
| + | $db =& wfGetDB( DB_MASTER ); | ||
| − | + | # Get commands if admin | |
| − | + | if ($GLOBALS['xwIsAdmin']) { | |
| − | + | if (xwGetProperty($properties, "SQL/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'); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
?> | ?> | ||
Latest revision as of 02:45, 18 March 2007
<? $db =& wfGetDB( DB_MASTER );
- Get commands if admin
if ($GLOBALS['xwIsAdmin']) { if (xwGetProperty($properties, "SQL/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'); } } } ?>



