我在这里得到的是我的计数值并保存到我的桌子但它不起作用。我只想得到计数值,你能帮帮我吗?我会感激任何答案。显示计数没问题,但只保存在我的表中。
<form method="POST">
Date : <input type="text" value="<?=$p_date?>" name="datereceived" />
<input type="submit" name="save" value="save">
</form>
PHP
<?
$sql="SELECT allinvty3.*, barcode.* , sample.*, count(barcode.itemcode) as icount
from barcode INNER JOIN sample on barcode.itemcode = sample.in_code INNER JOIN allinvty3 on
barcode.itemcode = allinvty3.in_code WHERE barcode.refnumber = '$temp'
GROUP BY barcode.itemcode";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$icount = $row['icount'];
}
if(isset($_POST['save'])){
$sql = "UPDATE barcode SET datereceived ='$p_date', actualacount = '".$icount."', status='COMPLETE' WHERE status='PENDING'";
$conn->query($sql) ;
}
?>
答案 0 :(得分:3)
因为SQL中有错误。试试这个
$sql = "UPDATE barcode SET
datereceived ='".$p_date."' , actualacount ='".$icount."' ,
status='COMPLETE' WHERE status='PENDING'";