• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Niecny Problem. z PHP

Status
Not open for further replies.

Jensej

Member
Joined
Feb 28, 2009
Messages
807
Reaction score
8
Witam.
Mam 1 problem.
otóż
27195029.jpg

Gdy wybiorę Gildie nr 3. Zawsze dodaje pkt gildi numer 1.


Chciałem zaznaczyć że usuń działa. Ale został problem z Akceptuj. Proszę o pomoc.



kod
PHP:
		<?PHP
	$bgcolor1 = $config['site']['darkborder'];
	$bgcolor = $config['site']['lightborder']; 
	$bgcolor2 = $config['site']['vdarkborder'];
	$dane = $SQL->query("SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy` FROM `z_points_guild` ORDER BY `id` DESC LIMIT 1")->fetch();
	$accountid = $SQL->query("SELECT `account_id` FROM `players` WHERE `name` = '".$dane['nazwalidera']."'; ")->fetch();
	$cos = $SQL->query("SELECT `id` FROM `z_points_guild`")->fetch();
	if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
	if($action == ""){
	
	
    $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 size=10 width=100%>
	<tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Witamy!<br><small><font color="gray">Znajdujesz się w Panelu Administratora. </font></small></b></center></td></tr>
	</td></tr></table><br>';
	
	
	 $main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1  WIDTH=100%>
	 <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center colspan=5><font color="white"><b>Lista Zapisanych Gildii</b></font></TD></TR>
	 <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center><font color="white">Lp.</b></TD><TD align=center><font color="white">Nazwa Gildi.</b></TD><TD align=center><font color="white">Nazwa Lidera.</b></TD><TD align=center><font color="white">Ilość graczy</b></TD><TD align=center><font color="white">Edytuj</b></TD></TR>
	
	
	
	';
		$i = 0;
		foreach($SQL->query('SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy`,`status` FROM `z_points_guild` ORDER BY `id` DESC,`nazwagildi` DESC
    LIMIT 0, 100;') as $dane) 
	{
	
	 $i++;
   $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '">
        <td>            
            <center>'.$i.'</center>
        </td>
        <td>            
            <center>'.$dane['nazwagildi'].'</center>
        </td>
        <td>
            <center>'.$dane['nazwalidera'].'</center>
        </td>
        <td>
            <center>'.$dane['iloscgraczy'].'</center>
        </td>
		  <td>
            <center><a href="?subtopic=panel&action=addpoints">Akceptuj</a> / <a href="?subtopic=panel&action=usun">Usuń</a></center>
        </td>
    </tr>';
	
} 
	 $main_content .= ' </TABLE> ';
	  
	
		//huj
		

	 }//action = ""
	  if($action == "addpoints"){
			 	$main_content .= '	'.$dane['nazwalidera'].' <br> '.$accountid['account_id'].'<br> '.$dane['iloscgraczy'].'';
	  if($dane['iloscgraczy'] == 10 ){
		$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 11 WHERE `id` = '".$accountid['account_id']."' ");
		
		}
	if($dane['iloscgraczy'] == 30 ){
		$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 22 WHERE `id` = '".$accountid['account_id']."' ");
		}
	if($dane['iloscgraczy'] == 40 ){ ///zaraz tutaj edit ja
		 $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 33 WHERE `id` = '".$accountid['account_id']."';");
		}
	$main_content .= 'Punkty Dodane<br>';	
	 $main_content .= '<br><a href="?subtopic=panel"><font color="blue">Back</font></a>';
	 }
	
	 
		if($action == "usun"){
		$SQL->query("DELETE FROM `z_points_guild` WHERE`id` = '".$dane['id']."' ");

				
				$main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
		<TR BGCOLOR="'.$bgcolor2.'"><TD align="center"><font color="white"><b>Zarządzaj:</b></TD></TR></font>
		<TR BGCOLOR="'.$bgcolor1.'"><TD style="padding-left:20px"><li><b>Wybrany Formularz został usunięty.</b></li>.</TD></TR>
	</TABLE>';
	
		$main_content .= '<br><a href="?subtopic=panel"><font color="blue">Back</font></a>';
	
	  
	  
	  
		}
	 	
	 
	 
	 
	 
	 
	 
	 
	 
	}// czy admin koniec
	

?>
 
Last edited:
Mógłbyś przynajmniej zrobić inny wygląd od mojego..
 
Nie pomagamy ! Bo chcesz to sprzedawać potem po 40 złotych ! :(
 
@up
i tak huja potrafisz. Twoja pomoc nic nie da.
 
PHP się uczę właśnie z kursów - donaj Ci powie ! Po skończeniu kursu będę miał takie gówienka w małym palcu ;) Nie zarobisz sobie hihi
 
Gówno nam po tym wycinku który dałeś, nawet nie wiemy jakie dane wysyła form input, (hidden?) or we.
Całość or bye i dawaj mi rekompensata.
 
dodane. Troche burdel Ale trza sie uczyc
 
@ALEH

To naprawdę spory problem, że użył takiego samego układu tabelek/opisów, sad, u mad?
----
Nie lepiej coś takiego?

index.php?subtopic=panel&action=addpoints&guild=ID

Po czym w :
PHP:
if($subtopic == "addpoints") {

$gildia = (int) $_GET['guild'];

}

I wtedy posługujesz się zmienną $gildia, do dodawania punktów / szukania konta lidera etc.
 
@samme
Jemu chodzi o to że on pokazuje mi jak wyglądają jego a ja sobie robie identyczne ;)

ps. Mógłbyś jakiś szerszy przykład pokazać z tym get? średnio mi idzie używanie tego.
 
zobacz sobie do guilds.php tam masz dobry przyklad.
 
Dane zamiast na początku:

$dane = $SQL->query("SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy` FROM `z_points_guild` ORDER BY `id` DESC LIMIT 1")->fetch();

Dajesz sobie w ifie (addpoints). I pobierasz zgodnie z ID gildii.
Mając te dane możesz dodać punkty gildii .
 
@samme
Jemu chodzi o to że on pokazuje mi jak wyglądają jego a ja sobie robie identyczne ;)

ps. Mógłbyś jakiś szerszy przykład pokazać z tym get? średnio mi idzie używanie tego.
W foreach przy wyświetlaniu listy zrób:
<a href=\"?subtopic=panel&action=addpoints&guild=".$zap['acc_id']."\">
i w if($action ~~) {
$guild = $_GET['guild'];
i teraz
$SQL->query('UPDATE `accounts` SET `premium_points` = premium_points + 123 WHERE `id` = '.$pkt);
 
zrobiłem tak jak Aleh polecił

błąd polega dalej na tym że dodaje pkt tylko 1 osobe z tabeli

http://localhost/?subtopic=panel&action=addpoints&guild=1


PHP:
<?PHP
	$bgcolor1 = $config['site']['darkborder'];
	$bgcolor = $config['site']['lightborder']; 
	$bgcolor2 = $config['site']['vdarkborder'];
	$dane = $SQL->query("SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy` FROM `z_points_guild` ORDER BY `id` DESC LIMIT 1;")->fetch();
	$accountid = $SQL->query("SELECT `account_id` FROM `players` WHERE `name` = '".$dane['nazwalidera']."'; ")->fetch();
	$cos = $SQL->query("SELECT `id` FROM `z_points_guild`")->fetch();
	if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
	if($action == ""){
	
	
    $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 size=10 width=100%>
	<tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Witamy!<br><small><font color="gray">Znajdujesz się w Panelu Administratora. </font></small></b></center></td></tr>
	</td></tr></table><br>';
	
	
	 $main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1  WIDTH=100%>
	 <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center colspan=5><font color="white"><b>Lista Zapisanych Gildii</b></font></TD></TR>
	 <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center><font color="white">Lp.</b></TD><TD align=center><font color="white">Nazwa Gildi.</b></TD><TD align=center><font color="white">Nazwa Lidera.</b></TD><TD align=center><font color="white">Ilość graczy</b></TD><TD align=center><font color="white">Edytuj</b></TD></TR>
	
	
	
	';
		$i = 0;
		foreach($SQL->query('SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy`,`status` FROM `z_points_guild` ORDER BY `id` DESC,`nazwagildi` DESC
    LIMIT 0, 100;') as $dane) 
	{
	
	 $i++;
   $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '">
        <td>            
            <center>'.$i.'</center>
        </td>
        <td>            
            <center>'.$dane['nazwagildi'].'</center>
        </td>
        <td>
            <center>'.$dane['nazwalidera'].'</center>
        </td>
        <td>
            <center>'.$dane['iloscgraczy'].'</center>
        </td>
		  <td>
            <center><a href="?subtopic=panel&action=addpoints&guild='.$accountid['account_id'].'">Akceptuj</a> / <a href="?subtopic=panel&action=usun">Usuń</a></center>
        </td>
    </tr>';
	
} 
	 $main_content .= ' </TABLE> ';
	  
	
		//huj
		

	 }//action = ""
	 
	  if($action == "addpoints"){
		$guild = $_GET['guild'];
	  		
	  if($dane['iloscgraczy'] == 10 ){
		$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = '".$accountid['account_id']."'"); 
		}
	if($dane['iloscgraczy'] == 30 ){
		$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = '".$accountid['account_id']."'"); 
		}
	if($dane['iloscgraczy'] == 40 ){ ///zaraz tutaj edit ja
		$SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = '".$accountid['account_id']."'"); 
		}
	$main_content .= 'Punkty Dodane<br>';	
	 $main_content .= '<br><a href="?subtopic=panel"><font color="blue">Back</font></a>';
	 }
	
	 
		if($action == "usun"){
		$SQL->query("DELETE FROM `z_points_guild` WHERE`id` = '".$dane['id']."' ");

				
				$main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
		<TR BGCOLOR="'.$bgcolor2.'"><TD align="center"><font color="white"><b>Zarządzaj:</b></TD></TR></font>
		<TR BGCOLOR="'.$bgcolor1.'"><TD style="padding-left:20px"><li><b>Wybrany Formularz został usunięty.</b></li>.</TD></TR>
	</TABLE>';
	
		$main_content .= '<br><a href="?subtopic=panel"><font color="blue">Back</font></a>';
	
	  
	  
	  
		}
	 	
	 
	 
	 
	 
	 
	 
	 
	 
	}// czy admin koniec
	

?>
 
Last edited:
PHP:
<?PHP
    $bgcolor1 = $config['site']['darkborder'];
    $bgcolor = $config['site']['lightborder']; 
    $bgcolor2 = $config['site']['vdarkborder'];
    $dane = $SQL->query("SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy` FROM `z_points_guild` ORDER BY `id` DESC LIMIT 1;")->fetch();
    $accountid = $SQL->query("SELECT `account_id` FROM `players` WHERE `name` = '".$dane['nazwalidera']."'; ")->fetch();
    $cos = $SQL->query("SELECT `id` FROM `z_points_guild`")->fetch();
    if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
    if($action == ""){
    
    
    $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 size=10 width=100%>
    <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Witamy!<br><small><font color="gray">Znajdujesz się w Panelu Administratora. </font></small></b></center></td></tr>
    </td></tr></table><br>';
    
    
     $main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1  WIDTH=100%>
     <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center colspan=5><font color="white"><b>Lista Zapisanych Gildii</b></font></TD></TR>
     <TR bgcolor="'.$config['site']['vdarkborder'].'"><TD align=center><font color="white">Lp.</b></TD><TD align=center><font color="white">Nazwa Gildi.</b></TD><TD align=center><font color="white">Nazwa Lidera.</b></TD><TD align=center><font color="white">Ilość graczy</b></TD><TD align=center><font color="white">Edytuj</b></TD></TR>
    
    
    
    ';
        $i = 0;
        foreach($SQL->query('SELECT `nazwagildi`,`id`,`nazwalidera`,`iloscgraczy`,`status` FROM `z_points_guild` ORDER BY `id` DESC,`nazwagildi` DESC
    LIMIT 0, 100;') as $dane) 
    {
    
		$players_id = $SQL->query('SELECT `account_id` FROM `players` WHERE `name` = "'.$dane['nazwalidera'].'";')->fetch();
	
     $i++;
   $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '">
        <td>            
            <center>'.$i.'</center>
        </td>
        <td>            
            <center>'.$dane['nazwagildi'].'</center>
        </td>
        <td>
            <center>'.$dane['nazwalidera'].'</center>
        </td>
        <td>
            <center>'.$dane['iloscgraczy'].'</center>
        </td>
          <td>
            <center><a href="?subtopic=rejes&action=addpoints&guild='.$players_id['account_id'].'">Akceptuj</a> / <a href="?subtopic=rejes&action=usun">Usuń</a></center>
        </td>
    </tr>';
    
} 
     $main_content .= ' </TABLE> ';
      
    
        //huj
        

     }//action = ""
     
      if($action == "addpoints"){
        $guild = $_GET['guild'];
              
      if($dane['iloscgraczy'] == 10 ){
        $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = ".$guild.";"); 
        }
    if($dane['iloscgraczy'] == 30 ){
        $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = ".$guild.";"); 
        }
    if($dane['iloscgraczy'] == 40 ){ ///zaraz tutaj edit ja
        $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + 123 WHERE `id` = ".$guild.";"); 
        }
    $main_content .= 'Punkty Dodane<br>';    
     $main_content .= '<br><a href="?subtopic=rejes"><font color="blue">Back</font></a>';
     }
    
     
        if($action == "usun"){
        $SQL->query("DELETE FROM `z_points_guild` WHERE`id` = '".$dane['id']."' ");

                
                $main_content .= '<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
        <TR BGCOLOR="'.$bgcolor2.'"><TD align="center"><font color="white"><b>Zarządzaj:</b></TD></TR></font>
        <TR BGCOLOR="'.$bgcolor1.'"><TD style="padding-left:20px"><li><b>Wybrany Formularz został usunięty.</b></li>.</TD></TR>
    </TABLE>';
    
        $main_content .= '<br><a href="?subtopic=rejes"><font color="blue">Back</font></a>';
    
      
      
      
        }
         
     
     
     
     
     
     
     
     
    }// czy admin koniec
    

?>
 
Last edited:
Proszę o zamknięcie.
Aleh jest moim mistrzem.
Reszcie też Serdecznie Dziękuję. (Samme)
 
Status
Not open for further replies.
Back
Top