src/SudoBible.php
protected function runPreparedQuery($strSql, array $aParams = [])
	{
		// call_user_func_array needs references, not values
		$aRefParams = [];
		foreach ($aParams as $k =>$v)
			$aRefParams[$k] = &$aParams[$k];

		// Build data type string for bind_param
		$strDataTypes = '';
		foreach ($aRefParams as $mValue)
			$strDataTypes .= is_int($mValue) ? 'i' : 's';
		array_unshift($aRefParams, $strDataTypes);

		// Prepare & execute
		$stmt = $this->db->prepare($strSql);
		call_user_func_array(array($stmt, 'bind_param'), $aRefParams);
		$stmt->execute();
		$oResult = $stmt->get_result();

		// Build return array
		$aReturn = [];
		$i = 0;
		while ($oRow = $oResult->fetch_object())
			$aReturn[] = $oRow;
		$stmt->close();

		return $aReturn;
	}
protected function runPreparedQuery($strSql, array $aParams = [])
	{
		// call_user_func_array needs references, not values
		$aRefParams = [];
		foreach ($aParams as $k =>$v)
			$aRefParams[$k] = &$aParams[$k];

		// Build data type string for bind_param
		$strDataTypes = '';
		foreach ($aRefParams as $mValue)
			$strDataTypes .= is_int($mValue) ? 'i' : 's';
		array_unshift($aRefParams, $strDataTypes);

		// Prepare & execute
		$stmt = $this->db->prepare($strSql);
		call_user_func_array(array($stmt, 'bind_param'), $aRefParams);
		$stmt->execute();
		$oResult = $stmt->get_result();

		// Build return array
		$aReturn = [];
		$i = 0;
		while ($oRow = $oResult->fetch_object())
			$aReturn[] = $oRow;
		$stmt->close();

		return $aReturn;
	}
protected function runPreparedQuery ( $ strSql , array $ aParams = [ ] ) { // call_user_func_array needs references, not values $ aRefParams = [ ] ; foreach ( $ aParams as $ k => $ v ) $ aRefParams [ $ k ] = & $ aParams [ $ k ] ; // Build data type string for bind_param $ strDataTypes = '' ; foreach ( $ aRefParams as $ mValue ) $ strDataTypes .= is_int ( $ mValue ) ? 'i' : 's' ; array_unshift ( $ aRefParams , $ strDataTypes ) ; // Prepare & execute $ stmt = $ this -> db -> prepare ( $ strSql ) ; call_user_func_array ( array ( $ stmt , 'bind_param' ) , $ aRefParams ) ; $ stmt -> execute ( ) ; $ oResult = $ stmt -> get_result ( ) ; // Build return array $ aReturn = [ ] ; $ i = 0 ; while ( $ oRow = $ oResult -> fetch_object ( ) ) $ aReturn [ ] = $ oRow ; $ stmt -> close ( ) ; return $ aReturn ; }
Run a "mysqli" prepared query, given the query string and params.

@param string $strSql Query string with "?" placeholders.
@param array $aParams Array of values to fill in for the placeholders.
@return array Result set.
Run a mysqli prepared query given the query string and params .