Jump to content
MakeWebGames

Inventry Help!


grimsybaby
 Share

Recommended Posts

im trying to revamp my inventry.php to make it look nicer and easyer to use :) but i have come across an errer which akes no sense to me, can someone check it over see if they could fix it please ? it'll be free to use once its been fixed, :) it's ment to show the wweapon's and Armour when equiping them :)

 

<?php
include "globals.php";
$q=$db->query("SELECT * FROM items WHERE itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']})");
print "<h3>Equipped Items</h3><hr />";
while($r=$db->fetch_row($q))
{
$equip[$r['itmid']]=$r;
}
print "<table width=75% border=0 align='center'>
 <tr>
   <td width=25%><div align='left'>Picture:</div></td>
   <td width=25% align='center' valign='middle'><div align='center'>"; if($id['itmpic']) { $itmpic = "[img={$id[]"; }";</div></td>
   <td width=25% align='center' valign='middle'><div align='center'>"; if($id['itmpic']) { $itmpic = "[img={$id[]"; }";</div></td>
   <td width=25% align='center' valign='middle'><div align='center'>"; if($id['itmpic']) { $itmpic = "[img={$id[]"; }";</div></td>
 </tr>
 <tr>
   <td><div align='left'>Item Name:</div></td>
   <td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_primary']]['itmid']) { print $equip[$ir['equip_primary']]['itmname']."</div></td>
   <td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_secondary']]['itmid']) { print $equip[$ir['equip_secondary']]['itmname']."</div></td>
   <td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_armor']]['itmid']) { print $equip[$ir['equip_armor']]['itmname']."</div></td>
 </tr>
 <tr>
   <td><div align='left'>Where Abouts: </div></td>
   <td align='center' valign='middle'><div align='center'>[b]Primary Weapon [/b]</div></td>
   <td align='center' valign='middle'><div align='center'>[b]Secondary Weapon [/b]</div></td>
   <td align='center' valign='middle'><div align='center'>[b]Armour[/b]</div></td>
 </tr>
 <tr>
   <td><div align='left'>Uniquip:</div></td>
   <td align='center' valign='middle'><div align='center'>[url='unequip.php?type=equip_primary']Unequip Item[/url]</div></td>
     ";
     }
     else
     {
     print "None equipped.
   <td align='center' valign='middle'><div align='center'>[url='unequip.php?type=equip_secondary']Unequip Item[/url]</div></td>
";
     }
     else
     {
     print "None equipped.
   <td align='center' valign='middle'><div align='center'>[url='unequip.php?type=equip_armor']Unequip Item[/url]</div></td>
";
     }
     else
     {
     print "None equipped.  </tr>
</table>
<hr />
<h3 align='center'>Inventory</h3>
<hr />
<div align='center'>";
 $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, i.itmname ASC");
 if ($db->num_rows($inv) == 0)
 {
 print "[b]You have no items![/b]";
 }
 else
 {
print "<div align='center'>[b]Your items are listed below.[/b]

 <table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">
   <tr>
     <td class=\"h\"><div align='center'>Item</div></td>
   <td class=\"h\"><div align='center'>Sell Value</div></td>
   <td class=\"h\"><div align='center'>Total Sell Value</div></td>
   <td class=\"h\"><div align='center'>Links</div></td>
   </tr>";
     $lt="";
     while($i=$db->fetch_row($inv))
     {
     if($lt!=$i['itmtypename'])
     {
     $lt=$i['itmtypename'];
     print "\n<tr><td colspan=4 align='center' valign='middle'><div align='center'>[b]{$lt}[/b]</div></td></tr>";
     }
     if($i['weapon'])
     {
     $i['itmname']="<font color='red'>*</font>".$i['itmname'];
     }
     if($i['armor'])
     {
     $i['itmname']="<font color='green'>*</font>".$i['itmname'];
     }
     print "<tr><td align='center' valign='middle'><div align='center'>
       <div align='center'>{$i['itmname']}";
         if ($i['inv_qty'] > 1)
         {
         print " x{$i['inv_qty']}";
         }
         print "</div></td><td><div align='center'>\${$i['itmsellprice']}</div></td><td><div align='center'>";
	  print "$".($i['itmsellprice']*$i['inv_qty']);
	  print "</td><td>[[url='iteminfo.php?ID={$i[']Info[/url]] [[url='itemsend.php?ID={$i[']Send[/url]] [[url='itemsell.php?ID={$i[']Sell[/url]] [[url='imadd.php?ID={$i[']Add To Market[/url]]";
               if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
               print " [[url='itemuse.php?ID={$i[']Use[/url]]";
               }
               if($i['weapon'])
               {
               print " [[url='equip_weapon.php?ID={$i[']Equip as Weapon[/url]]";
               }
               if($i['armor'])
               {
               print " [[url='equip_armor.php?ID={$i[']Equip as Armor[/url]]";
               }
               print " [[url='displayadd.php?ID=$userid&action=add&itm={$i[']Display[/url]]";
               }
               print "</div></td></tr>";
     }
     print "
 </table>
</div>

";
print "[size="1"][b]NB:[/b] Items with a small red [/size]<font color='red'>*</font>[size="1"] next to their name can be used as weapons in combat.

Items with a small green [/size]<font color='green'>*</font>[size="1"] next to their name can be used as armor in combat.[/size]";
print "


[[url='display.php?ID=$userid']Display Cabinet[/url]]";

$h->endpage();
?>

 

Parse error: syntax error, unexpected T_ELSE in /home/*username*/public_html/game/inventory.php on line 39

many thanks :)

-Simon-

Link to comment
Share on other sites

Re: Inventry Help!

<td align='center' valign='middle'><div align='center'>Unequip Item</div></td>

";

}

 

this line is closing... nothing! it seems to me you have the code messed up as from the while, as you are closing it almost immediat. It might not be that, but the line i pasted above is faulty for sure, maybe while dependent but out of it! also,

 

<td><div align='left'>Item Name:</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_primary']]['itmid']) { print $equip[$ir['equip_primary']]['itmname']."</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_secondary']]['itmid']) { print $equip[$ir['equip_secondary']]['itmname']."</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_armor']]['itmid']) { print $equip[$ir['equip_armor']]['itmname']."</div></td>

 

You are not closing if's here.

Link to comment
Share on other sites

Re: Inventry Help!

 

<td align='center' valign='middle'><div align='center'>Unequip Item</div></td>

";

}

 

this line is closing... nothing! it seems to me you have the code messed up as from the while, as you are closing it almost immediat. It might not be that, but the line i pasted above is faulty for sure, maybe while dependent but out of it! also,

 

<td><div align='left'>Item Name:</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_primary']]['itmid']) { print $equip[$ir['equip_primary']]['itmname']."</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_secondary']]['itmid']) { print $equip[$ir['equip_secondary']]['itmname']."</div></td>

<td align='center' valign='middle'><div align='center'>"; if($equip[$ir['equip_armor']]['itmid']) { print $equip[$ir['equip_armor']]['itmname']."</div></td>

 

You are not closing if's here.

chears :) ill see if that works inabit :), im new to editing to revamp codes :) thought id see if people could find errors that i cant find :)

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.

 Share

×
×
  • Create New...