Print SQL query by messages
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@480 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
c48a017e0e
commit
06faef23e7
|
@ -12,6 +12,8 @@ th { background: #eee; }
|
||||||
fieldset { display: inline; vertical-align: top; padding: .5em .8em; margin: 0 .5em .5em 0; border: 1px solid #999; }
|
fieldset { display: inline; vertical-align: top; padding: .5em .8em; margin: 0 .5em .5em 0; border: 1px solid #999; }
|
||||||
p { margin: 0 20px 1em 0; }
|
p { margin: 0 20px 1em 0; }
|
||||||
img { vertical-align: middle; }
|
img { vertical-align: middle; }
|
||||||
|
code { background-color: #eee; }
|
||||||
|
.js .hidden { display: none; }
|
||||||
.error { color: red; background: #fee; padding: .5em .8em; }
|
.error { color: red; background: #fee; padding: .5em .8em; }
|
||||||
.message { color: green; background: #efe; padding: .5em .8em; }
|
.message { color: green; background: #efe; padding: .5em .8em; }
|
||||||
.char { color: #007F00; }
|
.char { color: #007F00; }
|
||||||
|
|
|
@ -15,6 +15,14 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.body.className = 'js';
|
||||||
|
function toggle(id) {
|
||||||
|
var el = document.getElementById(id);
|
||||||
|
el.className = (el.className == 'hidden' ? '' : 'hidden');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -197,7 +197,8 @@ function redirect($location, $message = null) {
|
||||||
|
|
||||||
function query_redirect($query, $location, $message, $redirect = true, $execute = true) {
|
function query_redirect($query, $location, $message, $redirect = true, $execute = true) {
|
||||||
global $mysql, $error, $SELF;
|
global $mysql, $error, $SELF;
|
||||||
$sql = ' <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('SQL command') . "</a>";
|
$id = "sql-" . count($_SESSION["messages"]);
|
||||||
|
$sql = " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('Edit') . '</a></span>';
|
||||||
if ($execute && !$mysql->query($query)) {
|
if ($execute && !$mysql->query($query)) {
|
||||||
$error = htmlspecialchars($mysql->error) . $sql;
|
$error = htmlspecialchars($mysql->error) . $sql;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -214,7 +214,7 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
$query = "SELECT " . ($select ? (count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) : "*") . " $from";
|
$query = "SELECT " . ($select ? (count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) : "*") . " $from";
|
||||||
echo "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> - <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('edit') . "</a></p>\n";
|
echo "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n";
|
||||||
|
|
||||||
$result = $mysql->query($query);
|
$result = $mysql->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
|
Loading…
Reference in a new issue