Browse Source

Add mysqli::fetch_assoc()

Mathieu Moulin 2 years ago
parent
commit
f48b361567
1 changed files with 17 additions and 0 deletions
  1. 17 0
      htdocs/core/db/mysqli.class.php

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

@@ -322,6 +322,23 @@ class DoliDBMysqli extends DoliDB
 		return $resultset->fetch_object();
 	}
 
+	// 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|null					Array or null if KO or end of cursor
+	 */
+	public function fetch_assoc($resultset)
+	{
+		// phpcs:enable
+		// If resultset not provided, we take the last used by connexion
+		if (!is_object($resultset)) {
+			$resultset = $this->_results;
+		}
+		return $resultset->fetch_assoc();
+	}
 
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**