我有一个带有编辑功能的更新表格。例如,用户使用srfno4568为三个项目创建了保修表单。我在表格中显示的代码完全正常。我的问题是当用户想要编辑数据时,我将如何显示具有相同id的3个项目。我希望所有关于srfno4568输出的数据都在一个。
这是我输出逐个数据的代码:
$sql="Select sales.srfno, sales.datecreated, sales.clientid, sales.referenceno, sales.returnreason, sales.explanation, sales_item.srfno, sales_item.retqty, sales_item.retserial, sales_item.retdesc from sales INNER JOIN sales_item ON sales.srfno=sales_item.srfno ORDER BY sales.status='OPEN' AND sales.srfno='$ppid'";
$res=$db->prepare($sql);
$res->execute();
while($row = $res->fetch(PDO::FETCH_ASSOC))
{
$srfno=$row['srfno'];
$datecreated=$row['datecreated'];
$tclientid=$row['clientid'];
$retqty=$row['retqty'];
$retserial=$row['retserial'];
$retdesc=$row['retdesc'];
$cli="Select name, address, contactno, contactperson from client where clientid=$tclientid";
$client=$db->prepare($cli);
$client->execute();
while($clie= $client->fetch(PDO::FETCH_ASSOC))
{
$clientname=$clie['name'];
$clientadd=$clie['address'];
$clientcontactname=$clie['contactperson'];
$clientcontact=$clie['contactno'];
}
$referenceno=$row['referenceno'];
$returnreason=$row['returnreason'];
$explanation=$row['explanation'];
}
然后我会打电话给他们输出
<td align="left">
<font color="#990000"></font>
<input type="text" name="qty" id="qty" value="<?php echo $retqty ?>" />
<td width="8"><font color="#990000"></font><input type="text" name="serialno" id="serialno" value="<?php echo $retserial ?>" />
<td><input type="text" name="desc" id="desc" value="<?php echo $retdesc ?>"/></td>
我只能为每个具有相同srfno的编辑表单输出1个项目