Jump to content

How to get this to display all results from the database under player id


TeddyKiller

Recommended Posts

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 />

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.