Jump to content
  • 0

Wyświetlanie wyników z bazy danych


Question

Siema.
Edytuje panel gracza na IPB i mam aplikację dotyczącą aukcji - dodajemy aukcje z posiadanych przedmiotów, pojazdów itp

Mam pewien problem ponieważ na liście aukcji wyświetla mi się tylko jedna, ostatnio dodana aukcja a chciałbym aby wyświetlały się np. 10 na pierwszej i kolejnych stronach. W kodzie mam tak.

modules_public/panel/market.php

<?php

 class public_game_panel_market extends ipsCommand
 {
	protected $page = 0;
	protected $per_page = 20;
	
	# CLOSE			1
	# BUY			2
	# OFFER			3
	# END 			4

	public function doExecute(ipsRegistry $registry)
	{
		if(!$this->memberData['member_id'])
		{
			$this->registry->output->showError('treść błędy');
		}
		
		
		switch($this->request['do'])
		{
			default:
			case 'list':
				$this->showMarketList();
				break;
			case 'view':
				$this->showMarketDetails();
				break;	
			case 'create':
				$this->showMarketCreate();
				break;	
		}
		
		$this->registry->output->setTitle('Rynek');
		$this->registry->output->addNavigation('Rynek', 'app=game&module=panel&section=market', 'false', 'game_market', 'public');
		$this->registry->output->sendOutput();
		
	}
	
	public function	showMarketList()
	{
		$this->page = isset($this->request['st']) ? intval($this->request['st']) : 0;
		# REDIRECT + CHAR
		if(isset($this->request['t_char']))
		{
			$this->registry->output->silentRedirect('index.php?app=game&module=panel&section=market&do=create&sort='.$this->request['sort'].'&char='.$this->request['t_char'].'');
		}
		
		# WYSWIETLANIE POSTACI
		$this->DB->query('SELECT `char_gid`, `char_uid`, `char_name` FROM end_character WHERE char_gid = '.(int)$this->memberData['member_id'].' AND !(char_block & 1)');
		$this->DB->execute();
		while($data = $this->DB->fetch())
		{
			$data['charname'] = str_replace('_', ' ', $data['char_name']);
			$characterList[] = $data;
		}
		
		#PAGINACJA
		require_once(IPSLib::getAppDir('game').'/sources/classes/gamelib.php');
	
		# WYSWIETLANIE LISTY AUKCJI WZGLÄ?DEM SORTOWANIA
		if($this->request['sort'] == 1)
		{
			#PAGINACJA
			$pages = $this->registry->output->generatePagination( array('totalItems'		=> GameLib::countMarketItems(),
			'itemsPerPage'		=> $this->per_page,
			'currentStartValue' => $this->page,
			'seoTitle'			=> 'false',
			'seoTemplate'		=> 'game_market',
			'baseUrl'			=> 'app=game&module=panel&section=market&sort='.$this->request['sort'].''
			));
		
			$this->DB->query('SELECT market_bid, market_uid, market_title, market_sub, market_type, market_extraid, market_price, market_end, char_name, member_id, members_display_name, members_seo_name FROM end_character, end_market, ipb_members WHERE char_uid = market_owner AND member_id = char_gid AND market_type = 1 AND market_status = 0 ORDER BY market_start DESC LIMIT '.$this->page.','.$this->per_page.'');
			$this->DB->execute();
		}
		if($this->request['sort'] == 2)
		{
			#PAGINACJA
			$pages = $this->registry->output->generatePagination( array(
			'totalItems'		=> GameLib::countMarketVehicles(),
			'itemsPerPage'		=> $this->per_page,
			'currentStartValue' => $this->page,
			'seoTitle'			=> 'false',
			'seoTemplate'		=> 'game_market',
			'baseUrl'			=> 'app=game&module=panel&section=market&sort='.$this->request['sort'].'',
			));
		
			$this->DB->query('SELECT market_bid, market_uid, market_title, market_sub, market_type, market_extraid, market_price, market_end, char_name, member_id, members_display_name, members_seo_name FROM end_character, end_market, ipb_members WHERE char_uid = market_owner AND member_id = char_gid AND market_type = 2 AND market_status = 0 ORDER BY market_uid DESC LIMIT '.$this->page.','.$this->per_page.'');
			$this->DB->execute();
		}

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
  • Administrator

A co robisz po tym kodzie:

$this->DB->query('SELECT market_bid, market_uid, market_title, market_sub, market_type, market_extraid, market_price, market_end, char_name, member_id, members_display_name, members_seo_name FROM end_character, end_market, ipb_members WHERE char_uid = market_owner AND member_id = char_gid AND market_type = 2 AND market_status = 0 ORDER BY market_uid DESC LIMIT '.$this->page.','.$this->per_page.'');
			$this->DB->execute();

Bo tutaj masz wywołanie pobierania danych z bazy ale nie masz nigdzie obróbki tego

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Dołącz do pierwszego newslettera Invision Community

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

W celu świadczenie usług przez nasz Serwis na najwyższym poziomie, w ramach Serwisu wykorzystujemy pliki Cookies (tzw. ciasteczka). Korzystając ze stron Serwisu IPSBEYOND.PL bez zmiany ustawień przeglądarki będą one zapisane w pamięci urządzenia. Jeżeli nie dokonacie Państwo zmiany ustawień przeglądarki internetowej to wyrażacie zgodę na zapisywanie plików Cookies.