代码如下......错误是无效查询。它不是在数据库中更新表。有人请帮忙..
<?php
include "connection.php";
$selecteditem=$_POST['salesitem'];
$name=$_POST['name'];
$type=$_POST['type'];
$purchasePrice=$_POST['purchase'];
$salePrice=$_POST['sale'];
$iteminPack=$_POST['nofiteminpack'];
$location=$_POST['location'];
$GenName=$_POST['genric'];
$norcotics=$_POST['radio1'];
$stockinHand=$_POST['stockInHand'];
$conn= mysql_connect("localhost","root","");
mysql_select_db("alkausar",$conn);
$qr2="UPDATE `item` SET name=$name,type=$type,pPrice=$purchasePrice,sPrice=$salePrice,Iteminpack=$iteminPack,location=$location,genricName=$GenName,norcotics=$norcotics,stockInHand=$stockinHand WHERE name='$selecteditem'";
$qr3=mysql_query($qr2);
echo $qr3;
if(!$qr3){
die('Invalid Query:'.mysql_error());
}
?>
答案 0 :(得分:0)
您应该将所有输入都放在'
$qr2="UPDATE `item` SET
name='$name',
type='$type',
Price='$purchasePrice',
sPrice='$salePrice',
Iteminpack='$iteminPack',
location='$location',
genricName='$GenName',
norcotics='$norcotics',
stockInHand='$stockinHand'
WHERE name='$selecteditem'";
根据$_POST
中的内容,这可以解决您的问题。
如果没有,请回显$qr2
并尝试手动运行数据库,看看是否收到错误消息。