better way to show php code
This commit is contained in:
@@ -8,6 +8,7 @@ $Source$
|
|||||||
2002-07-13 Marc Delisle <lem9@users.sourceforge.net>
|
2002-07-13 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/common.lib.php3: bug 580929: do not EXPLAIN if this is
|
* libraries/common.lib.php3: bug 580929: do not EXPLAIN if this is
|
||||||
not a SELECT
|
not a SELECT
|
||||||
|
* sql.php3: better way to show php code
|
||||||
|
|
||||||
2002-07-13 Alexander M. Turek <rabus@users.sourceforge.net>
|
2002-07-13 Alexander M. Turek <rabus@users.sourceforge.net>
|
||||||
* Documentation.html: News about bug #540671.
|
* Documentation.html: News about bug #540671.
|
||||||
|
16
sql.php3
16
sql.php3
@@ -8,7 +8,6 @@
|
|||||||
require('./libraries/grab_globals.lib.php3');
|
require('./libraries/grab_globals.lib.php3');
|
||||||
require('./libraries/common.lib.php3');
|
require('./libraries/common.lib.php3');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the url to return to in case of error in a sql statement
|
* Defines the url to return to in case of error in a sql statement
|
||||||
*/
|
*/
|
||||||
@@ -244,7 +243,7 @@ else {
|
|||||||
$sql_query = stripslashes($sql_query);
|
$sql_query = stripslashes($sql_query);
|
||||||
}
|
}
|
||||||
// Defines some variables
|
// Defines some variables
|
||||||
// loic1: A table have to be created -> left frame should be reloaded
|
// loic1: A table has to be created -> left frame should be reloaded
|
||||||
if ((!isset($reload) || $reload == 0)
|
if ((!isset($reload) || $reload == 0)
|
||||||
&& eregi('^CREATE TABLE[[:space:]]+(.*)', $sql_query)) {
|
&& eregi('^CREATE TABLE[[:space:]]+(.*)', $sql_query)) {
|
||||||
$reload = 1;
|
$reload = 1;
|
||||||
@@ -328,9 +327,12 @@ else {
|
|||||||
|
|
||||||
// Executes the query
|
// Executes the query
|
||||||
// only if we didn't ask to see the php code (mikebeck)
|
// only if we didn't ask to see the php code (mikebeck)
|
||||||
if (empty($GLOBALS['show_as_php'])){
|
if (!empty($GLOBALS['show_as_php'])){
|
||||||
$result = @PMA_mysql_query($full_sql_query);
|
unset($result);
|
||||||
|
$num_rows = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$result = @PMA_mysql_query($full_sql_query);
|
||||||
// Displays an error message if required and stop parsing the script
|
// Displays an error message if required and stop parsing the script
|
||||||
if (PMA_mysql_error()) {
|
if (PMA_mysql_error()) {
|
||||||
$error = PMA_mysql_error();
|
$error = PMA_mysql_error();
|
||||||
@@ -397,6 +399,7 @@ else {
|
|||||||
$unlim_num_rows = 0;
|
$unlim_num_rows = 0;
|
||||||
}
|
}
|
||||||
} // end rows total count
|
} // end rows total count
|
||||||
|
} // end else "didn't ask to see php code"
|
||||||
|
|
||||||
// No rows returned -> move back to the calling page
|
// No rows returned -> move back to the calling page
|
||||||
if ($num_rows < 1 || $is_affected) {
|
if ($num_rows < 1 || $is_affected) {
|
||||||
@@ -408,6 +411,8 @@ else {
|
|||||||
$message = $strAffectedRows . ' ' . $num_rows;
|
$message = $strAffectedRows . ' ' . $num_rows;
|
||||||
} else if (!empty($zero_rows)) {
|
} else if (!empty($zero_rows)) {
|
||||||
$message = $zero_rows;
|
$message = $zero_rows;
|
||||||
|
} else if (!empty($GLOBALS['show_as_php'])){
|
||||||
|
$message = $strPhp;
|
||||||
} else {
|
} else {
|
||||||
$message = $strEmptyResultSet;
|
$message = $strEmptyResultSet;
|
||||||
}
|
}
|
||||||
@@ -487,11 +492,12 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets the list of fields properties
|
// Gets the list of fields properties
|
||||||
|
if (isset($result) && $result) {
|
||||||
while ($field = PMA_mysql_fetch_field($result)) {
|
while ($field = PMA_mysql_fetch_field($result)) {
|
||||||
$fields_meta[] = $field;
|
$fields_meta[] = $field;
|
||||||
}
|
}
|
||||||
$fields_cnt = count($fields_meta);
|
$fields_cnt = count($fields_meta);
|
||||||
|
}
|
||||||
// Displays the results in a table
|
// Displays the results in a table
|
||||||
include('./libraries/display_tbl.lib.php3');
|
include('./libraries/display_tbl.lib.php3');
|
||||||
if (empty($disp_mode)) {
|
if (empty($disp_mode)) {
|
||||||
|
Reference in New Issue
Block a user