bug 1108521 part 3: do not send a boolean to mysql_num_rows or mysqli_num_rows
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2005-02-02 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* libraries/dbi/*: PMA_DBI_num_rows(): do not send a boolean
|
||||
to mysqli_num_rows() or mysql_num_row(), it expects a result resource
|
||||
|
||||
2005-01-30 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* libraries/export/sql.php: bug #1108521, part 2: mysqli_num_rows
|
||||
cannot be used with MYSQL_USE_RESULT
|
||||
|
@@ -214,7 +214,11 @@ function PMA_DBI_close($link = NULL) {
|
||||
}
|
||||
|
||||
function PMA_DBI_num_rows($result) {
|
||||
return mysql_num_rows($result);
|
||||
if (!is_bool($result)) {
|
||||
return mysql_num_rows($result);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_DBI_insert_id($link = NULL) {
|
||||
|
@@ -113,6 +113,11 @@ function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
|
||||
$query = PMA_convert_charset($query);
|
||||
}
|
||||
return mysqli_query($link, $query, $method);
|
||||
// From the PHP manual:
|
||||
// "note: returns TRUE on success or FALSE on failure. For SELECT,
|
||||
// SHOW, DESCRIBE or EXPLAIN, mysqli_query() will return a result object"
|
||||
// so, do not use the return value to feed mysqli_num_rows() if it's
|
||||
// a boolean
|
||||
}
|
||||
|
||||
// The following function is meant for internal use only.
|
||||
@@ -224,7 +229,12 @@ function PMA_DBI_close($link = NULL) {
|
||||
}
|
||||
|
||||
function PMA_DBI_num_rows($result) {
|
||||
return @mysqli_num_rows($result);
|
||||
// see the note for PMA_DBI_try_query();
|
||||
if (!is_bool($result)) {
|
||||
return @mysqli_num_rows($result);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_DBI_insert_id($link = '') {
|
||||
|
Reference in New Issue
Block a user