我只想更新我最新插入的数据.. 但我确定我在WHERE
(at $query1
and $query2
)上错了
<?php
include "koneksi.php";
$kdj=$_POST['kdj'];
$id=$_POST['id'];
$qty = $_POST['qty'];
$kodelagi = mysql_query("Select kd_jual from nota ORDER BY id_nota DESC LIMIT 1");
$row = mysql_fetch_array($kodelagi);
$kodelagi1 = $row['kd_jual'];
if((!empty($id)) && (!empty($kdj)) && (!empty($qty)))
{
$query = mysql_query("INSERT INTO nota (id_item,qty,kd_jual) values ('$id','$qty','$kdj');");
$query1 = mysql_query("UPDATE nota,item SET nota.harga_item = item.harga_item WHERE nota.kd_jual = '$kodelagi1'");
$query2 = mysql_query("UPDATE nota SET subtotal = harga_item * qty WHERE nota.kd_jual = '$kodelagi1'");
?><script language="Javascript">;
document.location = 'transaksi2.php' </script><?php
}else
{
print "<script>alert('Maaf, tidak boleh ada field yang kosong !');
javascript:history.go(-1);</script>";
}?>
因为当我运行这个时,我刚刚在我的数据库中得到了这个
| id_nota | id_item | harga_item | qty | subtotal | Kd_jual
| 57 | 11 | 0 | 23 | 0 |13-10-201323:32:20