$sql));
		debuglog('Ran Raw SQL: ' . $sql);
		$r = db_query($sql, false);
		if (!$r) {
			output("`\$SQL Error:`& %s`0`n`n",db_error($r));
		} else {
			if (db_affected_rows() > 0) {
				output("`&%s rows affected.`n`n",db_affected_rows());
			}
			rawoutput("
");
			$number = db_num_rows($r);
			for ($i = 0; $i < $number; $i++) {
				$row = db_fetch_assoc($r);
				if ($i == 0) {
					rawoutput("");
					$keys = array_keys($row);
					foreach ($keys as $value) {
						rawoutput("| $value | ");
					}
					rawoutput("
");
				}
				rawoutput("");
				foreach ($keys as $value) {
					rawoutput("| {$row[$value]} | ");
				}
				rawoutput("
");
			}
			rawoutput("
");
		}
	}
	output("Type your query");
	$execute = translate_inline("Execute");
	$ret = modulehook("rawsql-modsql",array("sql"=>$sql));
	$sql = $ret['sql'];
	rawoutput("");
	addnav("", "rawsql.php");
}else{
	$php = stripslashes(httppost("php"));
	$source = translate_inline("Source:");
	$execute = translate_inline("Execute");
	if ($php>""){
		rawoutput("$source
");
		rawoutput(highlight_string("",true));
		rawoutput("
");
		output("`bResults:`b`n");
		modulehook("rawsql-execphp",array("php"=>$php));
		ob_start();
		eval($php);
		output_notl(ob_get_contents(),true);
		ob_end_clean();
		debuglog('Ran Raw PHP: ' . $php);
	}
	output("`n`nType your code:");
	$ret = modulehook("rawsql-modphp",array("php"=>$php));
	$php = $ret['php'];
	rawoutput("");
	addnav("", "rawsql.php?op=php");
}
page_footer();
?>