我需要明智地过滤数据吗?

时间:2013-12-11 06:37:06

标签: javascript php mysql

我需要为一个部分(vechile)过滤数据,但是它取得与之相关的所有结果而不是客户明智的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']);

            ?>    

1 个答案:

答案 0 :(得分:0)

替换

 $sql="SELECT DISTINCT(PARTNO) FROM `paidamount` ORDER BY `PARTNO`";

此查询与以下查询: -

 $sql="SELECT DISTINCT(PARTNO) as PARTNO FROM `paidamount` ORDER BY `PARTNO`";