I've hit a stump... PHP
Posted: Sat Mar 20, 2010 7:24 pm
To start off, I watched the tutorial vids... made the game, and then started from scratch once I had a fair understanding of what was going on. Currently, my problem is that when I list your "gear"... if you have something attached to your weapon, the attachment carries through every item in the list. I have tried everything I can think of as a beginner, and to no avail.
Code: Select all
echo "<small>";
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%'>";
$iteminfo="SELECT * from items where playerid='$playerid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
print "<table border='1' bordercolor='#404040' bgcolor='#404040'>";
print "<tr><td><b>Name</b><font color='#404040'>________________</font></td><td><b>Increase</b><font color='#404040'>______</td><td><font color='#404040'><b>Attachment</b>___</td><td><b><font color='#404040'>Rare</b><font color='#404040'>______</td><td><b>Level</b><font color='#404040'>______</td></tr>";
while($iteminfo3=mysql_fetch_array($iteminfo2))
{
$getinfo="SELECT * from items where attachment='0'";
$getinfo2=mysql_query($getinfo) or die("could not get info..");
$getinfo3=mysql_fetch_array($getinfo2);
$weaponattachedto = $getinfo3['weaponid'];
$currentscan = $iteminfo3['id'];
if ($weaponattachedto = $currentscan)
{
$attachname = "None";
} *** IF I TAKE THIS OUT, THE PROBLEM HAPPENS ***
else *** IF I LEAVE IT IN, EVERYTHING HAS AN ***
{ *** ATTACHMENT OF "None" ***
$attachname = $attachinfo3['name'];
}
print "<tr><td>$iteminfo3[name]<font color='#404040'>__---</font><A href='remove.php?id=$iteminfo3[id]'>Remove</a></td><td>$iteminfo3[base]</td><td>$attachname</td><td>$iteminfo3[rare]</td><td>$iteminfo3[level]</td></td><td>";
$counter = 1;
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";