Szablon wyświetlania przedmiotów:
Cytat
<td>
<table class="wh">
<tr>
<td><input type="checkbox" class="" name="to_update[]" value="{$slot}"></td><td align="center"><img src="{$image}" title="body=[{$title}]"></td>
</tr>
<tr>
<td>Price:</td> <td><input type="text" maxlength="7" name="of_price[]" size="7" value="{$price}"></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="button" value="-" onClick="window.location='delete.php?id={$slot}'"></td>
</tr>
</table></form></td>
<table class="wh">
<tr>
<td><input type="checkbox" class="" name="to_update[]" value="{$slot}"></td><td align="center"><img src="{$image}" title="body=[{$title}]"></td>
</tr>
<tr>
<td>Price:</td> <td><input type="text" maxlength="7" name="of_price[]" size="7" value="{$price}"></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="button" value="-" onClick="window.location='delete.php?id={$slot}'"></td>
</tr>
</table></form></td>
Wyświetlanie przedmiotów:
<?php $rows=0; $getStorageItems = $this->query(\"SELECT * FROM __tabela__ WHERE place='market' and name='\".$this->Player.\"'\"); if ($rows == 5) { $rows = 0; } else { $rows++; } $item_info = $this->item->get($Storage['slotid'], 1); $this->smarty->assign(\"image\", $item_info[0]); $this->smarty->assign(\"title\", $item_info[1]); $this->smarty->assign(\"slot\", $Storage['slotid']); $this->smarty->assign(\"price\", $Storage['price']); $this->smarty->display(\"market.tpl\"); } '; ?>
Po naciśnięciu "Update all items":
<?php $update = $_POST['to_update']; $of_price = $_POST['of_price']; for ($i=0; $i $game->market->update_stall($update[$i], $of_price[$i]); '; } } } else { } ?>
Funkcja update_stall:
<?php function update_stall($slot_id, $price) { $slot_id = (int)$slot_id; $price = (int)$price; if ($price == 0) { $price = 500; } $this->query(\"UPDATE __tabela__ SET place='market', price='\".$price.\"' WHERE slotid='\".$slot_id.\"'\"); } ?>
Problem jest w tym, że gdy zaznaczę pierwszy przedmiot i zmienię cenę, na przykład na 1000, zaakceptuję - dobrze, cena dla pierwszego przedmiotu się zmieni.
Natomiast, gdy zmienię cenę drugiego przedmiotu, na przykład na 17000 (zaznaczając checkbox) i nacisnę na przycisk "Update all items", cena zmienia się na cenę poprzednią. Tak jest cały czas.
Co jest nie tak?