我试图让登录的用户在一个框中输入一个值,然后提交它,表单将它存储在“money”下的数据库中。但是,当我尝试这样做时,我得到错误:表'servername.array'不存在。我知道服务器(蓝色)和表(玩家)存在,但不知道为什么会出现此错误。用户在 $_SESSION['username'] 和 $_SESSION['id'] 下登录。
<?php include("auth.php");?>
<?php
if(isset($_POST['submit']))
{
$player = @mysql_query
("SELECT id, username, password, registered, lastlogin, money,
callname, email FROM players WHERE username =
'".$_SESSION['username']."'");
$player = @mysql_fetch_assoc($player);
$getmoney = @mysql_query("INSERT INTO $player(money) values('$_POST[amount]')")
or die("Error: ".mysql_error());
echo '
<div style="
top: 395;
left: 99;
position: absolute;
z-index: 1;
visibility: show;">
Money Received.
</div>
';
}
?>
</head>
<body>
<p>Bank</p>
Enter amount of money to recieve.<br>
<form action="bank.php" method="post">
<table border=2>
<tr>
<td>Amount to Receive:</td><td><input type="text" name="amount" size="20px"></input>
</td>
</tr>
</table>
<input type="submit" name="submit" value="Get Money"></input>
</form><br><br>