Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Sprawdz czy istnieje wpis w bazie
atyll
post
Post #1





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 21.07.2007

Ostrzeżenie: (0%)
-----


Witam

Napisałem kod, który sprawdza czy w tabeli player_storage, istnieje wpis key = 100 dla ID gracza(player_id)
Pokazuje poprawnie gdy wpis istnieje, lecz nie wyświetla się nic, gdy wpis nie istnieje.

Mój kod:
  1. <?php
  2. $GetPlayerID = $player->attrs['id']; // zaladuj ID gracza
  3.  
  4. $result = mysql_query("SELECT * FROM `player_storage` WHERE `player_id` =$GetPlayerID AND `key` =100");
  5.  
  6. while($info = mysql_fetch_array($result))
  7. {
  8. if($info['key'] == 100 && $info['player_id'] == $GetPlayerID)
  9. {
  10. // If player completed the quest, display result
  11. echo 'This player completed annihilator.';
  12. }
  13. else
  14. {
  15. die("QUEST NOT COMPLETED!");
  16. }
  17. }
  18.  
  19. ?>


Moja baza wygląda tak:
(IMG:http://oi49.tinypic.com/2i0aofp.jpg)

Mógłby mi ktoś pomóc?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 8.10.2025 - 08:48