TeddyKiller Posted March 14, 2010 Share Posted March 14, 2010 I have a little script that only displays 1 item from the database. I've fiddled around and I've had no luck with it. I'm looking for it to display all items in the format of the echos. Can you please help me out? <b>Weapons:</b> <br /> <?php $q = $db->execute("select inventory.status, inventory.item_id from `inventory` where `player`=? order by `status` asc", array($player->id)); $itm = $q->fetchrow(); $query = $db->execute("select items.name, items.type from `items` where items.id='".$itm['item_id']."' and items.slot='weapon'"); if ($query->recordcount() < 0) { echo "<br /><b>You have no weapons.</b>"; } else { while($item = $query->fetchrow()) { echo "<fieldset>\n<legend>"; echo "<b>" . $item['name'] . "</b></legend>\n"; echo "<table width=\"100%\">\n"; echo "<tr><td width=\"85%\">"; echo "</td><td width=\"15%\">"; echo "<a href=\"shop.php?act=sell&id=" . $item_id . "\">Sell</a><br />"; echo "<a href=\"inventory.php?id=" . $item_id . "\">"; echo ($itm['status'] == "equipped")?"Unequip":"Equip"; echo "</a>"; echo "</td></tr>\n"; echo "</table>"; echo "</fieldset>\n<br />"; } } ?> <br /><br /> <br /> Link to comment https://forums.phpfreaks.com/topic/195193-how-to-get-this-to-display-all-results-from-the-database-under-player-id/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.