有人可以看看这个,也许看看为什么这没有更新我的数据库?
它是一种从我的数据库中提取数据的表单,当我单击更新按钮时,它应该更新数据库,但它没有。
有没有办法显示它是否返回错误?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Beerlist Admin</title>
</head>
<body>
<?php include '../beerlist/config.php'; ?>
<table border="0" width="95%" align="center" cellspacing="0" cellpadding="5">
<tr>
<?php
#///////////////////////////////////
#//////////// ALL BEERS/////////////
#///////////////////////////////////
$sql = "SELECT * FROM bottles ORDER BY name";
$mydata = mysql_query($sql,$con);
if (isset($_POST['update'])){
$UpdateQuery = "UPDATE bottles SET new='$_POST[new]', name='$_POST[name], style='$_POST[style], location='$_POST[location], size='$_POST[size], abv='$_POST[abv], number='$_POST[number], price='$_POST[price]' WHERE name='$_POST[hidden]'";
mysql_query ($UpdateQuery, $con);
};
while($record = mysql_fetch_array($mydata)){
echo "<form action=beerlist_admin.php method=post>";
echo "<td><input size=7 type=text name=new value=\"" . $record['new'] . "\" > ";
echo "<input type=text size=50 name=name value=\"" . $record['name'] . "\" >";
echo "<input type=text size=20 name=style value=\"" . $record['style'] . "\" >";
echo "<input type=text size=20 name=location value=\"" . $record['location'] . "\" >";
echo "<input type=text size=7 name=size value=\"" . $record['size'] . "\" >";
echo "<input type=text size=5 name=abv value=\"" . $record['abv'] . "\" >";
echo "<input type=text size=5 name=number value=\"" . $record['number'] . "\" >";
echo "<input type=text size=7 name=price value=\"" .$record['price'] . " \" >";
echo "<input type=hidden name=hidden value=" . $record['number'] . "\"> <input type=submit name=update value=update></td></tr>";
echo "</form>";
}
echo "</table>"
?>
</body>
</html>