I broke this up into parts, This is the equip and unequip part of the script.
Code: Select all
<?php
$type=$_GET['type'];
$local=$_GET['local'];
$randid=$_GET['randid'];
if ($type=="a")
{
$updateequip="Update playerarmor SET equip=0 WHERE pid='$id' AND equip=1 AND location='$local'";
mysql_query($updateequip) or die("Could not update armor");
$reequip="Update playerarmor set equip=1 where pid='$id' AND randid='$randid' AND location='$local'";
mysql_query($reequip) or die("Could not update armor2");
echo "<center><big><big>Armor Equipped<br></big></big>";
}
if ($type=="ua")
{
$updateequip="Update playerarmor SET equip=0 WHERE pid='$id' AND equip=1 AND location='$local'";
mysql_query($updateequip) or die("Could not update armor");
echo "<center><big><big>Armor UnEquipped<br></big></big>";
}
?>
This is the query for the armor and where it displays the weapon and armor table.
Code: Select all
<?php
print "<center><h3>Armor</h3></center>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$selectarmor="SELECT * from playerarmor where pid='$id'";
$selectarmor2=mysql_query($selectarmor) or die("could not select armor3");
print "<table border='1' bordercolor='white' bgcolor='#FFFFFF' >";
print "<tr><td><img src='Images/Name_Text.gif'></td><td>
<img src='Images/Defense_Text.gif'></td><td>
<img src='Images/Level_Text.gif'></td><td>
<img src='Images/Location_Text.gif'><td>
<img src='Images/Status_Text.gif'></td></tr>";
while($selectarmor3=mysql_fetch_array($selectarmor2))
{
if ($selectarmor3[equip] == 1)
{$selectarmor3[equip] = "<img src='Images/Equipped_Text.gif'>" . " <a href='Equipment.php?equip=1&type=ua&local=$selectarmor3[location]'><img src='Images/unequip_Button.gif'></a><br><br>";}
else {$selectarmor3[equip] = "<A href='equipment.php?equip=1&randid=$selectarmor3[randid]&type=a&local=$selectarmor3[location]'><img src='Images/Equip_Button.gif'></a>";}
$randid = $selectarmor3[randid];
print "<tr><td><center>$selectarmor3[name]</center></td><td><center>$selectarmor3[defense]</center></td><td><center>$selectarmor3[level]</center></td><td><center>$selectarmor3[location]</center></td><td><center>$selectarmor3[equip]</center></td>
</tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
}
?>