diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 8f2a9dc315e..68e29f22481 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -308,16 +308,20 @@ abstract class DoliDB implements Database * Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries * Dont add LIMIT to your query, it will be added by this method * @param string $sql the sql query string - * @return bool| object + * @return bool|int|object false on failure, 0 on empty, object on success */ public function getRow($sql) { - $sql .= ' LIMIT 1;'; + $sql .= ' LIMIT 1'; $res = $this->query($sql); - if ($res) - { - return $this->fetch_object($res); + if ($res) { + $obj = $this->fetch_object($res); + if ($obj) { + return $obj; + } else { + return 0; + } } return false;