我不斷收到此錯誤:您的SQL語法有錯誤;請檢查與您的MySQL服務器版本相對應的手冊,以便在第1行'WHERE username ='username'VALUES('value')'附近使用正確的語法。 代碼應該採用登錄用戶輸入的值放入表格中,然後將該值插入表格的錢列中。你的SQL語法有錯誤;檢查
<?php include("auth.php");?>
<?php
if(isset($_POST['submit']))
{
$getmoney = @mysql_query("INSERT INTO players (money) WHERE username =
'".$_SESSION['username']."' 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>
<hr size=2>
<?php include("footer.php");?>
</body>
</html>
什麼是執行的確切查詢? – Arjan 2012-07-21 06:54:59
由於這是一家「銀行」,我認爲他需要更新,但要增加當前的「金錢」數量。 – Novak 2012-07-21 06:56:49