Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Zabłąkane przedmioty
MaestroS
post
Post #1





Grupa: Zarejestrowani
Postów: 65
Pomógł: 0
Dołączył: 8.11.2006
Skąd: Kanagawa-ken, Japonia

Ostrzeżenie: (10%)
X----


Witam.

Mam taki kod, do wyświetlania przedmiotów ze schowka gracza.
CODE

function CreateStorage($character) {
echo '<table><tr>';
$counter = 0;
$GetPlayerInv = mysql_query("SELECT * FROM game_inventory WHERE character_name='" . $character . "'");
$InvAmount = mysql_num_rows($GetPlayerInv);
if ($InvAmount > 0) {
while ($BeforeDisplay = mysql_fetch_assoc($GetPlayerInv)) {
$GetInventory = mysql_query("SELECT * FROM game_inventory WHERE character_name='" . $character . "' and id='" . $BeforeDisplay['id'] . "'");
while ($Display = mysql_fetch_assoc($GetInventory)) {
$ItemInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM game_items WHERE item_name='" . $Display['item_name'] . "'"));
for ($i=0; $i<1; $i++) {
if ($counter==5) {
echo '</tr><tr>';
$counter=0;
} else {
echo '<td><img src="' . $ItemInfo['item_image'] . '">' . $Display['item_id'] . '</td>';
$counter++;
}
}
}
}
} else {
echo 'Your storage is empty.';
}
echo '</table>';
}
?>


Chodzi oto, że nie wszystkie są wyświetlane, czasami się jakiś zagubi i nie wyświetli - zupełnie nie wiem czemu 0.0


To moja tabela game_inventory


A tutaj "rezultat" funkcji:


Widać jasno i wyraźnie, że przynajmniej JEDNEJ zbroi nie ma.
Dlaczego ?

Ten post edytował MaestroS 24.09.2007, 14:54:03
Go to the top of the page
+Quote Post
qqrq
post
Post #2





Grupa: Zarejestrowani
Postów: 418
Pomógł: 8
Dołączył: 16.11.2006

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


Po pierwsze, to po jaki grzyb ci ta pętla questionmark.gif :

  1. <?php
  2. for ($i=0; $i<1; $i++) {
  3. if ($counter==5) {
  4. echo '</tr><tr>';
  5. $counter=0;
  6. } else {
  7. echo '<td><img src="' . $ItemInfo['item_image'] . '">' . $Display['item_id'] . '</td>';
  8. $counter++;
  9. }
  10. }
  11. ?>


Po drugie... Jeszcze nie widać? smile.gif

  1. <?php
  2. if ($counter==5) {
  3. echo '</tr><td><img src="' . $ItemInfo['item_image'] . '">' . $Display['item_id'] . '</td><tr>';
  4. $counter=0;
  5. }
  6. else
  7. { 
  8. echo '<td><img src="' . $ItemInfo['item_image'] . '">' . $Display['item_id'] . '</td>';
  9. $counter++;
  10. }
  11. ?>


I chwatit.


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 19.08.2025 - 06:31