我需要对零件(vechile)的ID数据进行明智的筛选,但它会获取与此相关的所有结果,而不是客户的PID(PID)。我的代码是
我要去哪里错了?
<?php
$sql="SELECT DISTINCT(PARTNO) FROM `paidamount` ORDER BY `PARTNO`";
$res=mysql_query($sql);
$num=mysql_num_rows($res);
if($num>0)
{
while($fetch=mysql_fetch_array($res))
{
?>
<tr>
<td colspan="15" align="left" style="background-color:#006699;"><p style=" color:#FFFFFF;"><strong><?php echo $fetch['PARTNO']?></strong></p></td>
</tr>
<?php
$sql="SELECT * FROM paidamount where paidamount.PARTNO='".$fetch['PARTNO']."' ORDER BY PARTNO";
//$sql="SELECT * FROM `paidamount`";
$result=mysql_query($sql);
$numrow=mysql_num_rows($result);
$i=1;
while($rows=mysql_fetch_array($result))
{
//echo $rows['id'];
$imid=explode(",",$rows['issued_med']);
$pmid=explode(",",$rows['ffffff']);
?>
最佳答案
更换
$sql="SELECT DISTINCT(PARTNO) FROM `paidamount` ORDER BY `PARTNO`";
此查询与以下查询:-
$sql="SELECT DISTINCT(PARTNO) as PARTNO FROM `paidamount` ORDER BY `PARTNO`";
关于javascript - 我需要明智地过滤数据ID吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20512196/