Difference between revisions of "SQL.php"

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

Revision as of 02:43, 18 March 2007

<? $db =& wfGetDB( DB_MASTER );

  1. Get commands if admin

if ($GLOBALS['xwIsAdmin']) { if (xwGetProperty($properties, "$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'); } } } ?>