瀏覽代碼

function to retrieve all in associative array : db::fetch_assoc_all

Mathieu Moulin 1 年之前
父節點
當前提交
61f5d3a8a3
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      htdocs/core/db/mysqli.class.php

+ 16 - 0
htdocs/core/db/mysqli.class.php

@@ -384,6 +384,22 @@ class DoliDBMysqli extends DoliDB
 		return $resultset->fetch_assoc();
 	}
 
+	// Added by MMI Mathieu Moulin iProspective
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+	/**
+	 *	Return datas as an array
+	 *
+	 *	@param	mysqli_result	$resultset	Resultset of request
+	 *	@return	array					Array or null if KO or end of cursor
+	 */
+	public function fetch_assoc_all($resultset)
+	{
+		$l = [];
+		while($row=$this->fetch_assoc($resultset))
+			$l[] = $row;
+		return $l;
+	}
+
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Return datas as an array