src/Suki/Db.php
public function read($params, $data, $key = false, $single = false)
	{
		global $smcFunc;
		$dataResult = [];
		$query = $smcFunc['db_query']('', '
			SELECT ' . $params['rows'] .'
			FROM {db_prefix}' . $params['table'] .'
			'. (!empty($params['join']) ? 'LEFT JOIN '. $params['join'] : '') .'
			'. (!empty($params['where']) ? 'WHERE '. $params['where'] : '') .'
				'. (!empty($params['and']) ? 'AND '. $params['and'] : '') .'
				'. (!empty($params['andTwo']) ? 'AND '. $params['andTwo'] : '') .'
			'. (!empty($params['order']) ? 'ORDER BY ' . $params['order'] : '') .'
			'. (!empty($params['limit']) ? 'LIMIT '. $params['limit'] : '') . '',
			$data
		);

		if (!empty($single))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult = $row;

		elseif (!empty($key) && empty($single))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult[$row[$key]] = $row;

		elseif (empty($single) && empty($key))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult[] = $row;

		$smcFunc['db_free_result']($query);

		return $dataResult;
	}
public function read($params, $data, $key = false, $single = false)
	{
		global $smcFunc;
		$dataResult = [];
		$query = $smcFunc['db_query']('', '
			SELECT ' . $params['rows'] .'
			FROM {db_prefix}' . $params['table'] .'
			'. (!empty($params['join']) ? 'LEFT JOIN '. $params['join'] : '') .'
			'. (!empty($params['where']) ? 'WHERE '. $params['where'] : '') .'
				'. (!empty($params['and']) ? 'AND '. $params['and'] : '') .'
				'. (!empty($params['andTwo']) ? 'AND '. $params['andTwo'] : '') .'
			'. (!empty($params['order']) ? 'ORDER BY ' . $params['order'] : '') .'
			'. (!empty($params['limit']) ? 'LIMIT '. $params['limit'] : '') . '',
			$data
		);

		if (!empty($single))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult = $row;

		elseif (!empty($key) && empty($single))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult[$row[$key]] = $row;

		elseif (empty($single) && empty($key))
			while ($row = $smcFunc['db_fetch_assoc']($query))
				$dataResult[] = $row;

		$smcFunc['db_free_result']($query);

		return $dataResult;
	}
public function read ( $ params , $ data , $ key = false , $ single = false ) { global $ smcFunc ; $ dataResult = [ ] ; $ query = $ smcFunc [ 'db_query' ] ( '' , '
			SELECT ' . $ params [ 'rows' ] . '
			FROM {db_prefix}' . $ params [ 'table' ] . '
			' . ( ! empty ( $ params [ 'join' ] ) ? 'LEFT JOIN ' . $ params [ 'join' ] : '' ) . '
			' . ( ! empty ( $ params [ 'where' ] ) ? 'WHERE ' . $ params [ 'where' ] : '' ) . '
				' . ( ! empty ( $ params [ 'and' ] ) ? 'AND ' . $ params [ 'and' ] : '' ) . '
				' . ( ! empty ( $ params [ 'andTwo' ] ) ? 'AND ' . $ params [ 'andTwo' ] : '' ) . '
			' . ( ! empty ( $ params [ 'order' ] ) ? 'ORDER BY ' . $ params [ 'order' ] : '' ) . '
			' . ( ! empty ( $ params [ 'limit' ] ) ? 'LIMIT ' . $ params [ 'limit' ] : '' ) . '' , $ data ) ; if ( ! empty ( $ single ) ) while ( $ row = $ smcFunc [ 'db_fetch_assoc' ] ( $ query ) ) $ dataResult = $ row ; elseif ( ! empty ( $ key ) && empty ( $ single ) ) while ( $ row = $ smcFunc [ 'db_fetch_assoc' ] ( $ query ) ) $ dataResult [ $ row [ $ key ] ] = $ row ; elseif ( empty ( $ single ) && empty ( $ key ) ) while ( $ row = $ smcFunc [ 'db_fetch_assoc' ] ( $ query ) ) $ dataResult [ ] = $ row ; $ smcFunc [ 'db_free_result' ] ( $ query ) ; return $ dataResult ; }
Reads data from a table.

@param array $params An array with all the params  for the query
@param array $data An array to pass to $smcFunc casting array
@param bool $key A boolean value to asign a row as key on the returning array
@param bool $single A bool to tell the query to return a single value instead of An array
@return mixed either An array or a var with the query result
Reads data from a table .