Commit b7094195 authored by Dries's avatar Dries
Browse files

- Patch #98988 by Robert Douglass et al: db_result should return FALSE if no...

- Patch #98988 by Robert Douglass et al: db_result should return FALSE if no result was found.  Consistent with PHP's mysql_result.
parent 225ebf38
......@@ -225,12 +225,13 @@ function db_num_rows($result) {
* @param $row
* The index of the row whose result is needed.
* @return
* The resulting field.
* The resulting field or FALSE.
*/
function db_result($result, $row = 0) {
if ($result && mysql_num_rows($result) > $row) {
return mysql_result($result, $row);
}
return FALSE;
}
/**
......
......@@ -209,13 +209,14 @@ function db_num_rows($result) {
* @param $row
* The index of the row whose result is needed.
* @return
* The resulting field.
* The resulting field or FALSE.
*/
function db_result($result, $row = 0) {
if ($result && mysqli_num_rows($result) > $row) {
$array = mysqli_fetch_array($result, MYSQLI_NUM);
return $array[0];
}
return FALSE;
}
/**
......
......@@ -202,7 +202,7 @@ function db_num_rows($result) {
* @param $row
* The index of the row whose result is needed.
* @return
* The resulting field.
* The resulting field or FALSE.
*/
function db_result($result, $row = 0) {
if ($result && pg_num_rows($result) > $row) {
......@@ -210,6 +210,7 @@ function db_result($result, $row = 0) {
return $res[0];
}
return FALSE;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment