Fixed a warning thanks to Svetlio Kovachev

This commit is contained in:
Loïc Chapeaux
2002-05-26 11:18:48 +00:00
parent 3d7942a0ef
commit e91b5dc62a
2 changed files with 19 additions and 14 deletions

View File

@@ -8,6 +8,10 @@ $Source$
2002-05-26 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2002-05-26 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* scripts/create-release.sh, line 60: added the "-P" option (prune empty * scripts/create-release.sh, line 60: added the "-P" option (prune empty
directory) for the cvs checkout. directory) for the cvs checkout.
* sql.php3:
- fixed a warning thanks to
Svetlio Kovachev <svetlio at users.sourceforge.net>;
- coding standards.
2002-05-25 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2002-05-25 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/common.lib.php3: * libraries/common.lib.php3:

View File

@@ -1,6 +1,7 @@
<?php <?php
/* $Id$ */ /* $Id$ */
/** /**
* Gets some core libraries * Gets some core libraries
*/ */
@@ -24,14 +25,14 @@ if (!empty($goto)) {
if (empty($goto)) { if (empty($goto)) {
$goto = (empty($table)) ? 'db_details.php3' : 'tbl_properties.php3'; $goto = (empty($table)) ? 'db_details.php3' : 'tbl_properties.php3';
$is_gotofile = TRUE; $is_gotofile = TRUE;
} } // end if
if (!isset($err_url)) { if (!isset($err_url)) {
$err_url = (!empty($back) ? $back : $goto) $err_url = (!empty($back) ? $back : $goto)
. '?lang=' . $lang . '?lang=' . $lang
. '&amp;server=' . $server . '&amp;server=' . $server
. (isset($db) ? '&amp;db=' . urlencode($db) : '') . (isset($db) ? '&amp;db=' . urlencode($db) : '')
. ((strpos(' ' . $goto, 'db_details') != 1 && isset($table)) ? '&amp;table=' . urlencode($table) : ''); . ((strpos(' ' . $goto, 'db_details') != 1 && isset($table)) ? '&amp;table=' . urlencode($table) : '');
} } // end if
/** /**
@@ -65,7 +66,7 @@ if (isset($store_bkm)) {
include('./libraries/bookmark.lib.php3'); include('./libraries/bookmark.lib.php3');
PMA_addBookmarks($fields, $cfg['Bookmark']); PMA_addBookmarks($fields, $cfg['Bookmark']);
header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto); header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto);
} } // end if
/** /**
@@ -110,7 +111,7 @@ if ($goto == 'sql.php3') {
. '&amp;table=' . urlencode($table) . '&amp;table=' . urlencode($table)
. '&amp;pos=' . $pos . '&amp;pos=' . $pos
. '&amp;sql_query=' . urlencode($sql_query); . '&amp;sql_query=' . urlencode($sql_query);
} } // end if
/** /**
@@ -253,13 +254,13 @@ else {
if ($is_delete if ($is_delete
&& eregi('^DELETE([[:space:]].+)?([[:space:]]FROM[[:space:]](.+))$', $sql_query, $parts) && eregi('^DELETE([[:space:]].+)?([[:space:]]FROM[[:space:]](.+))$', $sql_query, $parts)
&& !eregi('[[:space:]]WHERE[[:space:]]', $parts[3])) { && !eregi('[[:space:]]WHERE[[:space:]]', $parts[3])) {
$OPresult = @mysql_query('SELECT COUNT(*) as count' . $parts[2]); $cnt_all_result = @mysql_query('SELECT COUNT(*) as count' . $parts[2]);
if ($OPresult) { if ($cnt_all_result) {
$num_rows = mysql_result($OPresult, 0, 'count'); $num_rows = mysql_result($cnt_all_result, 0, 'count');
mysql_free_result($cnt_all_result);
} else { } else {
$num_rows = 0; $num_rows = 0;
} }
mysql_free_result($OPresult);
} }
// Executes the query // Executes the query
@@ -305,12 +306,12 @@ else {
'|' . $sp . 'GROUP' . $sp . 'BY' . $sp, $sql_query); '|' . $sp . 'GROUP' . $sp . 'BY' . $sp, $sql_query);
if (!empty($array[1])) { if (!empty($array[1])) {
// ... and makes a count(*) to count the entries // ... and makes a count(*) to count the entries
$count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1]; $count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1];
$OPresult = mysql_query($count_query); $cnt_all_result = mysql_query($count_query);
if ($OPresult) { if ($cnt_all_result) {
$unlim_num_rows = mysql_result($OPresult, 0, 'count'); $unlim_num_rows = mysql_result($cnt_all_result, 0, 'count');
mysql_free_result($cnt_all_result);
} }
mysql_free_result($OPresult);
} else { } else {
$unlim_num_rows = 0; $unlim_num_rows = 0;
} }