better way to show php code

This commit is contained in:
Marc Delisle
2002-07-13 20:33:15 +00:00
parent ce2e66a014
commit 638b1844b0
2 changed files with 58 additions and 51 deletions

View File

@@ -8,6 +8,7 @@ $Source$
2002-07-13 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php3: bug 580929: do not EXPLAIN if this is
not a SELECT
* sql.php3: better way to show php code
2002-07-13 Alexander M. Turek <rabus@users.sourceforge.net>
* Documentation.html: News about bug #540671.

View File

@@ -8,7 +8,6 @@
require('./libraries/grab_globals.lib.php3');
require('./libraries/common.lib.php3');
/**
* Defines the url to return to in case of error in a sql statement
*/
@@ -244,7 +243,7 @@ else {
$sql_query = stripslashes($sql_query);
}
// 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)
&& eregi('^CREATE TABLE[[:space:]]+(.*)', $sql_query)) {
$reload = 1;
@@ -328,9 +327,12 @@ else {
// Executes the query
// only if we didn't ask to see the php code (mikebeck)
if (empty($GLOBALS['show_as_php'])){
$result = @PMA_mysql_query($full_sql_query);
if (!empty($GLOBALS['show_as_php'])){
unset($result);
$num_rows = 0;
}
else {
$result = @PMA_mysql_query($full_sql_query);
// Displays an error message if required and stop parsing the script
if (PMA_mysql_error()) {
$error = PMA_mysql_error();
@@ -397,6 +399,7 @@ else {
$unlim_num_rows = 0;
}
} // end rows total count
} // end else "didn't ask to see php code"
// No rows returned -> move back to the calling page
if ($num_rows < 1 || $is_affected) {
@@ -408,6 +411,8 @@ else {
$message = $strAffectedRows . '&nbsp;' . $num_rows;
} else if (!empty($zero_rows)) {
$message = $zero_rows;
} else if (!empty($GLOBALS['show_as_php'])){
$message = $strPhp;
} else {
$message = $strEmptyResultSet;
}
@@ -487,11 +492,12 @@ else {
}
// Gets the list of fields properties
if (isset($result) && $result) {
while ($field = PMA_mysql_fetch_field($result)) {
$fields_meta[] = $field;
}
$fields_cnt = count($fields_meta);
}
// Displays the results in a table
include('./libraries/display_tbl.lib.php3');
if (empty($disp_mode)) {