Jump to content

Query Help I belive?


chevys

Recommended Posts

I have having some issues with the following Query.  I am going to post my Mysql tables as well for assistance.

 

The issue is there are 3 different itemtypes and it appears to be pulling them all in a list format, I need it to only pull 1 itemtype?

 

The item types are [weapon] [armor] [medicine]

 

--Table for Item Types--

 

Full Texts  itmtypeid itmtypename

Edit Delete 4 Medicine

Edit Delete 2 Armor

Edit Delete 3 Weapon

 

print "<div id='content_2' class='content'>

        <ul>";

}

$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$userid} ORDER BY i.itmtype ASC");

if ($db->num_rows($inv) == 0)

{

print "<b>You have no items!</b>";

}

else

{

print "<table width=100% border=\'0\' align='center' cellspacing=\'1\' class=\'table\'>";

$lt="";

while($i=$db->fetch_row($inv))

{

if($lt!=$i['itmtypename'])

{

$lt=$i['itmtypename'];

print "\n<tr><td colspan=4></td></tr>";

}

if($i['armor'])

{

  $i['itmname']="".$i['itmname'];

}

 

print "<tr><td>{$i['itmname']}";

if ($i['inv_qty'] > 1)

{

print " x{$i['inv_qty']}";

}

print "</td><td>[<a href=iteminfo.php?ID={$i['itmid]}'>Info</a>]";

if($i['armor'])

{

print " [<a href=equip_armor.php?ID={$i['inv_id]}'>Equip as Armor</a>]";

}

 

print "</td></tr>";

}

print "</table>";

}

print "</ul></div>";

 

If anyone can assist me i would greatly appreciate it!

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/183628-query-help-i-belive/
Share on other sites

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.