Where i made mistake?
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * FROM players WHERE name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id="table">
<?php
$playerid = $playerinfo3['id'];
$iteminfo="SELECT * FROM inventory WHERE id='$playerid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
$name = $iteminfo3['name'];
$sellprice = $iteminfo3['sellprice'];
$sellitem = "DELETE FROM inventory WHERE randid = '$iteminfo3[randid]'"; // shoud be here, i cant understand why cant sell item only with this rand code//
mysql_query($sellitem) or die("could not sell item from backpack");
$updateplayer="UPDATE players SET gold=gold+'$iteminfo3[sellprice]' WHERE name='$player'";
mysql_query($updateplayer) or die("Could not update player");
echo $name . " Sell";
echo "<center><a href='index.php'>Go Back</center>";
////did not make a - counter for item////
?>
</div>