Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL][PHP]2 pliki i problem, złe wyświetlanie
Forum PHP.pl > Forum > Przedszkole
Sahee
Siemka, mam 2 pliczki. jeden to szablon z inputboxem z nickiem a 2 to miejsce w ktorym się sprawdza ranking.
Mój szablon jest skonstruowany na zasaadzie zmiennych. $gra to zmienna w której jest wyświetlany text w tym oknie po prawej(lol)
I mam problem.
Pierwszy plik to http://kanciasci.pl/postac.php
Zawartość:
http://pastebin.com/gQPyi7V5

A drugi to: http://kanciasci.pl/get_member_details.php
Zawartośc:

http://pastebin.com/ESeMcXqJ


Co chcciałbym osiagnąc? to wszystko co wyswietla get_member wrzucic do zmiennej $gra. Czyli żeby wyswietlało sie pod inputboxem wink.gif
Ruch Radzionków
chodzi ci o to żeby po lewej stronie jak wpiszesz nick i dasz prześlij to po niżej wyskoczą informacje questionmark.gif
Sahee
Tak, profil gracza wink.gif le jakoś nie chce wyjsc ;/
Ruch Radzionków
zrób coś takiego:
  1. <?php
  2. echo'<form action="postac.php" method="post">
  3. <center>
  4. Nick osoby szukanej:
  5. <input type="text" name="nick" value="'.$oUser["login"].'"/>
  6. <input type="submit" name="submit"></form>';
  7. if(isset($_POST[submit]))
  8. {
  9. require_once('connector.php');
  10. //require_once('postac.php');
  11.  
  12. //----------------------------------------------------------------------------------------------
  13. $name = htmlspecialchars($_POST['nick']);
  14.  
  15. function details_member($name) {
  16. $result = @mysql_query("SELECT * FROM sc_players WHERE name = '".$name."'") or die(mysql_error());
  17. while($tmp=@mysql_fetch_assoc($result)) {
  18. $return[] = $tmp;
  19. }
  20. return $return;
  21. }
  22.  
  23. function details_attacker($name) {
  24. $result = @mysql_query("SELECT * FROM sc_kills WHERE attacker = '".$name."'ORDER BY kill_id DESC LIMIT 10") or die(mysql_error());
  25. while($tmp=@mysql_fetch_assoc($result)) {
  26. $return[] = $tmp;
  27. }
  28. return $return;
  29. }
  30.  
  31. function details_victim($name) {
  32. $result = @mysql_query("SELECT * FROM sc_kills WHERE victim = '".$name."'ORDER BY kill_id DESC LIMIT 10") or die(mysql_error());
  33. while($tmp=@mysql_fetch_assoc($result)) {
  34. $return[] = $tmp;
  35. }
  36. return $return;
  37. }
  38.  
  39. function attacker_test($name) {
  40. foreach (details_member($name) as $player) {
  41. if ( $player['civilian_kills'] >= 1 OR $player['rival_kills'] >= 1 OR $player['neutral_kills'] >= 1 ) {
  42. return true;
  43. }
  44. }
  45. }
  46.  
  47. function victim_test($name) {
  48. foreach (details_member($name) as $player) {
  49. if ( $player['deaths'] == 0 ) {
  50. return true;
  51. }
  52. }
  53. }
  54.  
  55.  
  56.  
  57.  
  58. //-----------------------------------------------------------------------------------------------
  59. ?>
  60. <table width='800px'>
  61. <tr>
  62. <td>
  63. <table align='center' width='270px' border='0'>
  64. <? if(attacker_test($name) == true): ?>
  65. <tr><th align='left' colspan='3'>10 Recent Kills</th></tr>
  66. <tr><th align='left'>Victim</th><th align='left'>Clan Tag</th><th align='left'>Typ</th></tr>
  67. <? foreach(details_attacker($name) as $player ): ?>
  68. <tr>
  69. <td width='150px'><?=substr($player['victim'], 0, 12);?></td>
  70. <td width='80px'><?=strtoupper($player['victim_tag'])?><?if($player['victim_tag'] == '')echo'------';?></td>
  71. <td width='60px'><?switch($player['kill_type']){case 'c': echo'Civil';break;case 'n':echo'Neutral';break;case 'r':echo'Rival';break;}?></td>
  72. </tr>
  73. <? endforeach; ?>
  74. <? else: ?>
  75. Dieser Spieler hat noch niemanden getötet.
  76. <? endif; ?>
  77. </table>
  78. </td>
  79. <td>
  80. <table width='220px' align='center'>
  81. <tr>
  82. <td align='center'><b><?=substr($name, 0, 20)?></b><br/></td>
  83. </tr>
  84. <tr>
  85. <td align='center'><? if ( $dynmap !== '####' ) {echo"<img src='http://$dynmap/tiles/faces/body/$name.png' height='100px' /></td>";} else {echo"<img src='img/standard_body.png' height='100px' /></td>";} ?>
  86. </tr>
  87. <tr>
  88. <td align='center'>
  89.  
  90. <table width='220px' border='0'>
  91. <tr>
  92. <td align='left'><b>Join Clan</b></td>
  93. <td align='right'><b>Last Join</b></td>
  94. </tr>
  95. <tr>
  96. <td align='left'>
  97. <?foreach (details_member($name) as $member ): ?>
  98. <? $join_clan = $member['join_date'];
  99. $seconds = $join_clan / 1000;
  100. echo date('d-m-Y', $seconds); ?>
  101. <? endforeach; ?>
  102. </td>
  103. <td align='right'>
  104. <?foreach (details_member($name) as $member ): ?>
  105. <? $last_on = $member['last_seen'];
  106. $seconds= $last_on / 1000;
  107. echo date('d-m-Y', $seconds); ?>
  108. <? endforeach; ?>
  109. </td>
  110. </tr>
  111. </table>
  112.  
  113. </td>
  114. </tr>
  115. </table>
  116. </td>
  117. <td>
  118. <table align='right' width='270px' border='0'>
  119. <? if(victim_test($name) == false): ?>
  120. <tr><th align='right' colspan='3'>10 Recent Deaths</th></tr>
  121. <tr><th align='left'>Attacker</th><th align='left'>Clan Tag</th><th align='left'>Typ</th></tr>
  122. <? foreach(details_victim($name) as $player ): ?>
  123. <tr><td width='150px' align='left'><?=substr($player['attacker'], 0, 12);?></td>
  124. <td width='80px' align='left'><?=strtoupper($player['attacker_tag'])?><?if($player['attacker_tag'] == '')echo'------';?></td>
  125. <td width='40px' align='left'><?switch($player['kill_type']){case 'c': echo'Civil';break;case 'n':echo'Neutral';break;case 'r':echo'Rival';break;}?></td></tr>
  126. <? endforeach; ?>
  127. <? else: ?>
  128. Dieser Spieler ist noch nicht gestorben.
  129. <? endif; ?>
  130. </table>
  131. </td>
  132. </tr>
  133. </table>
  134. </td>
  135. </tr>
  136. </table>
  137. <?php
  138. }
  139. ?>


nie sprawdzałem czy ten kod 2 masz dobrze ale takie coś powinno być ok
Sahee
Dziala tak samo jak dzialalo, lecz zamiast dawac te statystyki w tym okienku daje je ponad headerem ;/
to co wychodzi z tego pliku trzeba wszystko ogarnąc w $gra .=""; aby to dzialalo, ale nie mam pojęcia jak haha.gif
Ruch Radzionków
po 1 to styl muszisz dopasowac do tego
Sahee
można zrobić include tego co wyszło wpisać to w zmienna i potem zrobić $gra.= $zmienna_statystyk
Tak to chodzi czysto ale nie wyświetla statystyk lol :
  1. <?php
  2. require_once('inc/system.php');
  3. include ($xxx . "get_member_details.php");
  4.  
  5. echo $xxx;
  6. $gra .='<form action="postac.php" method="post">
  7. <center>
  8.  
  9. Nick osoby szukanej:
  10. <input type="text" name="nick" value="".$oUser["login"].""/>
  11. </form><input type="submit"></form>
  12. '.$xxx.'';
  13. require_once('inc/szablon.php');
  14. ?>




Dobra, poradze sobei jakoś z iframe. Dzieki za probe pomocy wink.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.