我正在尝试按类而不是 id 使用 ajax 更新行数量
到目前为止我的代码是
include('config.php');
$id=$_GET[id];
$sql2="SELECT * FROM `orders` WHERE `id` = '".$id."'";
$result2 = mysql_query($sql2);
$row2 = mysql_fetch_array($result2);
$order=$_GET[order];
$qty=$_GET[qty];
$sql="SELECT * FROM `stock` WHERE `part` = '".$part."'";
$result = mysql_query($sql);
$row1 = mysql_fetch_array($result);
$lineprice=$qty * $row2[price];
$sqlins1 = "UPDATE `orders` SET qty='$qty', lineprice='$lineprice' WHERE id = '".$id."'";
if (!mysql_query($sqlins1,$con))
{
die('Error: ' . mysql_error());
}
$sql="SELECT * FROM `orders` WHERE `invoice` = '".$order."' ORDER BY id DESC";
$result = mysql_query($sql);
echo" <table id='POITable' width='100%' border='1'>
<tr>
<td>SKU</td>
<td>QTY</td>
<td width='45%'>item</td>
<td>Unit Price</td>
<td>Line Price</td>
<td>Delete</td>
</tr>";
while($row = mysql_fetch_array($result))
{
echo"<tr><td>" . $row['part'] . "</td><td><form name='test'>
<input type='hidden' value='" . $row[id] . "' id='part'> <input type='text' id='qty' value='" . $row['qty'] . "' onblur='updateqty(this.id)'></form></td><td>" . $row['description'] . "</td><td>" . $row['price'] . "</td><td>" . $row['lineprice'] . "</td><td> <input type='image' src='images/btn_delete.png' value='" . $row[id] . "' onclick='deletesku(this.value)' height='30'/></td>
";
}
对此的任何帮助将不胜感激,
非常感谢