From e230a3a264ce7e81b0ea61111ebc72161f406a82 Mon Sep 17 00:00:00 2001 From: ATM john Date: Sat, 18 Apr 2020 16:24:12 +0200 Subject: [PATCH] add num row test --- htdocs/core/db/DoliDB.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index e3e0491b298..3bb5e025c34 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -313,8 +313,10 @@ abstract class DoliDB implements Database $res = $this->query($sql); if ($res) { - $Tresult = $this->fetch_row($res); - return $Tresult[0]; + if($this->num_rows($res) > 0) { + $Tresult = $this->fetch_row($res); + return reset($Tresult); + } } return false;