Re: Video#5
Posted: Tue Jul 07, 2009 8:57 pm
here it is:
Code: Select all
<?php
include_once 'connect.php';
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$creature=$_GET['creature'];
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$playerid=$playerinfo3['id']; <---line21
$counter = 0;
echo "<small>";
print "<left>";
print "<table border='1' bordercolor='blue' bgcolor='#000099' width='25%' cellspacing='25'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo= "SELECT * from inventory where id='$playerid'";
$invinfo2=mysql_query($invinfo) or die("could not select player inventory");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>_______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td>$invinfo3[price]</td><td><A href='battle.php?randid=$invinfo3[randid]&creature=$creature'>Use Item</a></td><td><A href='sellitem.php?randid=$invinfo3[randid]&itemname=$invinfo3[name]'>Sell Item</a></tr>";
$counter = 1;
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>You have Nothing in your inventory!<br>";
echo "<a href='battle.php?creature=$creature'>Go Back</center>";
exit;
}
echo "<center><a href='battle.php?creature=$creature'>Go Back</center>";
?>