当我试图执行代码时,我会收到一个错误,说“时间”是意外的。知道我哪里出问题了吗?我试图只让一个用户出价,如果他们还不是出价最高的。一切都很好直到我尝试加入我的如果..。其他陈述。
<?php
session_start();
require_once("dbconnect.inc");
$accountid=$_SESSION['accountid'];
$itemid=$_POST['itemid'];
mysql_query("SELECT accountid FROM bidhistory
WHERE biditem = '$itemid' ORDER BY bidhistoryid DESC");
$result=mysql_query($sql)
while($row = mysql_fetch_array($result)){
$checkaccountid = $row['accountid'];
if($checkaccountid == $accountid){
echo "You are the highest bidder!";
}
else {
$sql="INSERT INTO bidhistory (accountid, biditemid)
VALUES ($accountid, $itemid)";
mysql_query("
UPDATE bidhistory
SET bidprice = bidprice + 1
WHERE biditemid = " .
@mysql_escape_string($itemid));
$result=mysql_query($sql) or die("Error in adding bid for item: ".mysql_error());
}
}
?>发布于 2015-07-14 04:53:19
需要添加分号到
$result=mysql_query($sql)所以..。
$result=mysql_query($sql);https://stackoverflow.com/questions/31397872
复制相似问题