Jump to content
MakeWebGames

inventory img


orsino

Recommended Posts

hello   i need some help on my inventory page 

im trying to get img of the items on my inventory page 

 

all items already have images  and in iteminfo they can already see the images 

 

on this inventory page in code below  i need2 changes 

1 showing img on equiped items 

2 bug fix on img showing 

the bug is that the page only shows the img of the first item i have in inventory 

and repeats showing the img of item 1 in inventory 

 

<?php
require("globals.php");


echo "<h3>Your Equipment</h3><hr />
<div class='row'>
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Primary Weapon ";
if (!empty($ir['equip_primary'])) {
    echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_primary'])) {
    echo $api->SystemItemIDtoName($ir['equip_primary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Secondary Weapon ";
if (!empty($ir['equip_secondary'])) {
    echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_secondary'])) {
    echo $api->SystemItemIDtoName($ir['equip_secondary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Armor ";
if (!empty($ir['equip_armor'])) {
    echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_armor'])) {
    echo $api->SystemItemIDtoName($ir['equip_armor']);
} else {
    echo "No Armor";
}
echo "
			</div>
		</div>
	</div>
</div><br/>";
echo "<div class='row'>
<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Pet ";
if (!empty($ir['equip_pet'])) {
    echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_pet'])) {
    echo $api->SystemItemIDtoName($ir['equip_pet']);
} else {
    echo "No pet";
}
echo "
			</div>
		</div>
	</div>";
echo "<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Head ";
if (!empty($ir['equip_head'])) {
    echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_head'])) {
    echo $api->SystemItemIDtoName($ir['equip_head']);
} else {
    echo "No head";
}
echo "
			</div>
		</div>
             </div>
	</div>";
echo "<hr />
<h3>Your Inventory</h3><hr />";
$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
        $id = $db->fetch_row($inv);
$itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail style='background-color: transparent width='50' height='50'>" : '';
echo "<b>Your items are listed below.</b><br />
	<table class='table table-bordered table-striped'>
	    <thead>
		<tr>
                        <th>Item Img</th>
			<th>Item (Qty)</th>
			<th class='hidden-xs-down'>Item Cost (Total)</th>
			<th>Links</th>
		</tr></thead>";
$lt = "";
while ($i = $db->fetch_row($inv)) {
    if ($lt != $i['itmtypename']) {
        $lt = $i['itmtypename'];
        echo "\n<thead><tr>
            			<th colspan='4'>
            				<b>{$lt}</b>
            			</th>
            		</tr></thead>";
    }
    $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
    echo "<tr>
   <td>     	
{$itmpic}
</td>	
<td>
					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
						{$api->SystemItemIDtoName($i['itmid'])}
                                                   
					</a>";
    if ($i['inv_qty'] > 1) {
        echo " (" . number_format($i['inv_qty']) . ")";
    }
    echo "</td>
        	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
    echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
    echo "</td>
        	  <td>
        	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
        	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
    if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
        echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
    }
    if ($i['weapon'] > 0) {
        echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
    }
    if ($i['armor'] > 0) {
        echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
    }
    if ($i['pet'] > 0) {
        echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
    }
    if ($i['head'] > 0) {
        echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
    }
    echo "</td>
        </tr>";
}
echo "</table>";
$db->free_result($inv);
$h->endpage();

 

Link to comment
Share on other sites

$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
        $id = $db->fetch_row($inv); 

//this is getting the img url so it should work if he fixes his markup 

 

Link to comment
Share on other sites

16 hours ago, orsino said:

$itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail style='background-color: transparent width='50' height='50'>" : '';

Move that down into your while loop a few lines down and then close your class attribute thingy with a single quote.

For your equipped images, that requires a little bit more work since you are not querying the database for item information other than in your api class you are using. In order to fix that you need to query the information from the database. If you did that you would have no use for the api class though or you would have more queries running than you need

Edited by KyleMassacre
Link to comment
Share on other sites

On 1/24/2020 at 1:01 PM, KingKong said:

$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
        $id = $db->fetch_row($inv); 

//this is getting the img url so it should work if he fixes his markup 

 

can you help me on that please

 

Link to comment
Share on other sites

10 minutes ago, orsino said:

can you help me on that please

 

My response fixes your inventory images. You need to get your equipped images working now right?

This is the default MCC inventory page up at the top that queries your equipped items: 

$q =
        $db->query(
                "SELECT `itmid`, `itmname`
                 FROM `items`
                 WHERE `itmid`
                  IN({$ir['equip_primary']}, {$ir['equip_secondary']},
                     {$ir['equip_armor']})");
echo "<h3>Equipped Items</h3><hr />";
$equip = array();
while ($r = $db->fetch_row($q))
{
    $equip[$r['itmid']] = $r;
}
$db->free_result($q);
echo "<table width='75%' cellspacing='1' class='table'>
<tr>
<th>Primary Weapon</th>
<td>";
if (isset($equip[$ir['equip_primary']]))
{
    print
            $equip[$ir['equip_primary']]['itmname']
                    . "</td><td><a href='unequip.php?type=equip_primary'>Unequip Item</a></td>";
}
else
{
    echo "None equipped.</td><td>&nbsp;</td>";
}

You need to update the query to add your item pic column and then your pic would be shown like:

print "<img src='{$equip[$ir['equip_primary']]['itempic']}'/>";

 

Link to comment
Share on other sites

6 minutes ago, orsino said:

no  i moved that line into the while  like you said   need to found out to close the class atribute 

 

 

 

On 1/24/2020 at 4:24 AM, KyleMassacre said:

$itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail style='background-color: transparent width='50' height='50'>" : '';

to:
$itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail' style='background-color: transparent;' width='50' height='50'>" : '';

Edited by KyleMassacre
Link to comment
Share on other sites

so i did like you said ( thx alot for your help )

bug is still there 

 

<?php
require("globals.php");


echo "<h3>Your Equipment</h3><hr />
<div class='row'>
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Primary Weapon ";
if (!empty($ir['equip_primary'])) {
    echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_primary'])) {
    echo $api->SystemItemIDtoName($ir['equip_primary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Secondary Weapon ";
if (!empty($ir['equip_secondary'])) {
    echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_secondary'])) {
    echo $api->SystemItemIDtoName($ir['equip_secondary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Armor ";
if (!empty($ir['equip_armor'])) {
    echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_armor'])) {
    echo $api->SystemItemIDtoName($ir['equip_armor']);
} else {
    echo "No Armor";
}
echo "
			</div>
		</div>
	</div>
</div><br/>";
echo "<div class='row'>
<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Pet ";
if (!empty($ir['equip_pet'])) {
    echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_pet'])) {
    echo $api->SystemItemIDtoName($ir['equip_pet']);
} else {
    echo "No pet";
}
echo "
			</div>
		</div>
	</div>";
echo "<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Head ";
if (!empty($ir['equip_head'])) {
    echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_head'])) {
    echo $api->SystemItemIDtoName($ir['equip_head']);
} else {
    echo "No head";
}
echo "
			</div>
		</div>
             </div>
	</div>";
echo "<hr />
<h3>Your Inventory</h3><hr />";
$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
        $id = $db->fetch_row($inv);
echo "<b>Your items are listed below.</b><br />
	<table class='table table-bordered table-striped'>
	    <thead>
		<tr>
                        <th>Item Img</th>
			<th>Item (Qty)</th>
			<th class='hidden-xs-down'>Item Cost (Total)</th>
			<th>Links</th>
		</tr></thead>";
$lt = "";
while ($i = $db->fetch_row($inv)) {
    if ($lt != $i['itmtypename']) {
        $lt = $i['itmtypename'];
$itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail' style='background-color: transparent width='50' height='50'>" : '';
        echo "\n<thead><tr>
            			<th colspan='4'>
            				<b>{$lt}</b>
            			</th>
            		</tr></thead>";
    }
    $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
    echo "<tr>
   <td>     	
{$itmpic}
</td>	
<td>
					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
						{$api->SystemItemIDtoName($i['itmid'])}
                                                   
					</a>";
    if ($i['inv_qty'] > 1) {
        echo " (" . number_format($i['inv_qty']) . ")";
    }
    echo "</td>
        	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
    echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
    echo "</td>
        	  <td>
        	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
        	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
    if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
        echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
    }
    if ($i['weapon'] > 0) {
        echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
    }
    if ($i['armor'] > 0) {
        echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
    }
    if ($i['pet'] > 0) {
        echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
    }
    if ($i['head'] > 0) {
        echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
    }
    echo "</td>
        </tr>";
}
echo "</table>";
$db->free_result($inv);
$h->endpage();

 

Link to comment
Share on other sites

Let me try and fix it for you real quick because this can go on forever

<?php
require("globals.php");


echo "<h3>Your Equipment</h3><hr />
<div class='row'>
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Primary Weapon ";
if (!empty($ir['equip_primary'])) {
    echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_primary'])) {
    echo $api->SystemItemIDtoName($ir['equip_primary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Secondary Weapon ";
if (!empty($ir['equip_secondary'])) {
    echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_secondary'])) {
    echo $api->SystemItemIDtoName($ir['equip_secondary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Armor ";
if (!empty($ir['equip_armor'])) {
    echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_armor'])) {
    echo $api->SystemItemIDtoName($ir['equip_armor']);
} else {
    echo "No Armor";
}
echo "
			</div>
		</div>
	</div>
</div><br/>";
echo "<div class='row'>
<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Pet ";
if (!empty($ir['equip_pet'])) {
    echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_pet'])) {
    echo $api->SystemItemIDtoName($ir['equip_pet']);
} else {
    echo "No pet";
}
echo "
			</div>
		</div>
	</div>";
echo "<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Head ";
if (!empty($ir['equip_head'])) {
    echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_head'])) {
    echo $api->SystemItemIDtoName($ir['equip_head']);
} else {
    echo "No head";
}
echo "
			</div>
		</div>
             </div>
	</div>";
echo "<hr />
<h3>Your Inventory</h3><hr />";
$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
echo "<b>Your items are listed below.</b><br />
	<table class='table table-bordered table-striped'>
	    <thead>
		<tr>
                        <th>Item Img</th>
			<th>Item (Qty)</th>
			<th class='hidden-xs-down'>Item Cost (Total)</th>
			<th>Links</th>
		</tr></thead>";
$lt = "";
while ($i = $db->fetch_row($inv)) {
    if ($lt != $i['itmtypename']) {
        $lt = $i['itmtypename'];
$itmpic = ($i['itmpic']) ? "<img src='{$i['itmpic']}' class='thumbnail' style='background-color: transparent;' width='50px' height='50px'>" : '';
        echo "\n<thead><tr>
            			<th colspan='4'>
            				<b>{$lt}</b>
            			</th>
            		</tr></thead>";
    }
    $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
    echo "<tr>
   <td>     	
{$itmpic}
</td>	
<td>
					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
						{$api->SystemItemIDtoName($i['itmid'])}
                                                   
					</a>";
    if ($i['inv_qty'] > 1) {
        echo " (" . number_format($i['inv_qty']) . ")";
    }
    echo "</td>
        	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
    echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
    echo "</td>
        	  <td>
        	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
        	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
    if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
        echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
    }
    if ($i['weapon'] > 0) {
        echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
    }
    if ($i['armor'] > 0) {
        echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
    }
    if ($i['pet'] > 0) {
        echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
    }
    if ($i['head'] > 0) {
        echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
    }
    echo "</td>
        </tr>";
}
echo "</table>";
$db->free_result($inv);
$h->endpage();

 

Link to comment
Share on other sites

so i fixed the bug 

i moved the line given by KylleMassacre 

now the only thing i need is the images in equiped items

<?php
require("globals.php");


echo "<h3>Your Equipment</h3><hr />
<div class='row'>
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Primary Weapon ";
if (!empty($ir['equip_primary'])) {
    echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_primary'])) {
    echo $api->SystemItemIDtoName($ir['equip_primary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Secondary Weapon ";
if (!empty($ir['equip_secondary'])) {
    echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_secondary'])) {
    echo $api->SystemItemIDtoName($ir['equip_secondary']);
} else {
    echo "No Weapon";
}
echo "
			</div>
		</div>
	</div>";
echo "
	<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Armor ";
if (!empty($ir['equip_armor'])) {
    echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_armor'])) {
    echo $api->SystemItemIDtoName($ir['equip_armor']);
} else {
    echo "No Armor";
}
echo "
			</div>
		</div>
	</div>
</div><br/>";
echo "<div class='row'>
<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Pet ";
if (!empty($ir['equip_pet'])) {
    echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_pet'])) {
    echo $api->SystemItemIDtoName($ir['equip_pet']);
} else {
    echo "No pet";
}
echo "
			</div>
		</div>
	</div>";
echo "<div class='col-sm-4'>
		<div class='card'>
			<div class='card-header'>
				Head ";
if (!empty($ir['equip_head'])) {
    echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
}
echo "
			</div>
			<div class='card-body'>";
if (!empty($ir['equip_head'])) {
    echo $api->SystemItemIDtoName($ir['equip_head']);
} else {
    echo "No head";
}
echo "
			</div>
		</div>
             </div>
	</div>";
echo "<hr />
<h3>Your Inventory</h3><hr />";
$inv =
    $db->query(
        "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                 `effect1_on`, `effect2_on`, `effect3_on`,
                 `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                 FROM `inventory` AS `iv`
                 INNER JOIN `items` AS `i`
                 ON `iv`.`inv_itemid` = `i`.`itmid`
                 INNER JOIN `itemtypes` AS `it`
                 ON `i`.`itmtype` = `it`.`itmtypeid`
                 WHERE `iv`.`inv_userid` = {$userid}
                 ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
echo "<b>Your items are listed below.</b><br />
	<table class='table table-bordered table-striped'>
	    <thead>
		<tr>
                        <th>Item Img</th>
			<th>Item (Qty)</th>
			<th class='hidden-xs-down'>Item Cost (Total)</th>
			<th>Links</th>
		</tr></thead>";
$lt = "";
while ($i = $db->fetch_row($inv)) {
    if ($lt != $i['itmtypename']) {
        $lt = $i['itmtypename'];
        echo "\n<thead><tr>
            			<th colspan='4'>
            				<b>{$lt}</b>
            			</th>
            		</tr></thead>";
    }
    $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
$itmpic = ($i['itmpic']) ? "<img src='{$i['itmpic']}' class='thumbnail' style='background-color: transparent;' width='50px' height='50px'>" : '';
    echo "<tr>
   <td>     	
{$itmpic}
</td>	
<td>
					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
						{$api->SystemItemIDtoName($i['itmid'])}
                                                   
					</a>";
    if ($i['inv_qty'] > 1) {
        echo " (" . number_format($i['inv_qty']) . ")";
    }
    echo "</td>
        	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
    echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
    echo "</td>
        	  <td>
        	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
        	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
    if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
        echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
    }
    if ($i['weapon'] > 0) {
        echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
    }
    if ($i['armor'] > 0) {
        echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
    }
    if ($i['pet'] > 0) {
        echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
    }
    if ($i['head'] > 0) {
        echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
    }
    echo "</td>
        </tr>";
}
echo "</table>";
$db->free_result($inv);
$h->endpage();

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...