1.
$a=strpos($rs1["a03"],".");
if ($a>0){
   $a--;
   $fnml=substr($rs1["a03"],0,$a);
}2.
if (strlen($fnml)==2) $fnml="0".$fnml2

解决方案 »

  1.   

    <? 
    if (!empty($page))
    {
      $currentPage=intval($page);
    }
      else
    {
      $currentPage=1;

    if (!$rs1->eof)
    {
      $MaxPerPage=10;
      $totalPut=$rs1->recordcount;
      if ($currentpage<1)
      {
        $currentpage=1;
      } 
      if (($currentpage-1)*$MaxPerPage>$totalput)
      {
        if (($totalPut%$MaxPerPage)==0)
        {
          $currentpage=$totalPut$\$MaxPerPage;
        }
          else
        {
          $currentpage=$totalPut$\$MaxPerPage+1;
        } 
      }   if ($currentPage==1)
      {
        showContent();
        showpage($totalput,$MaxPerPage,"favo.asp");
      }
        else
      {
        if (($currentPage-1)*$MaxPerPage<$totalPut)
        {
         $rs1->move($currentPage-1)*$MaxPerPage;
          showContent();
          showpage($totalput,$MaxPerPage,"favo.asp");
        }
          else
        {
          $currentPage=1;
          showContent($totalput,$MaxPerPage,"favo.asp");
          showpage($totalput,$MaxPerPage,"favo.asp");
        } 
      } 
    $rs1->close; //you table close;

    function showContent()
    {
      $i=0;
      while(!$rs1<>'0')  
      {
    //if  isnull(rs1("a03"))=true then
    //a03="0"
    //else
    //a03=rs1("a03")
    //end if
    //a003=split(a03,",")
    //t01=ubound(a003)
    // $rsh5 is of type "adodb.recordset"
        $sql5="select count(*) as a05 from  plvote where a02=5 and a01=".$rs["a00"]."";
        $rsh5=mysql_query($sql5);
    $rsh5=mysql_fetch_array($rsh5);
        $aa05=$rsh5["a05"];
    // $rsh4 is of type "adodb.recordset"
        $sql4="select count(*) as a04 from  plvote where a02=4 and a01=".$rs["a00"]."";
        $rsh4=mysql_query($sql4); 
    $rsh4=mysql_fetch_array($rsh4);
        $aa04=$rsh4["a04"];
    // $rsh3 is of type "adodb.recordset"
        $sql3="select count(*) as a03 from  plvote where a02=3 and a01=".$rs["a00"]."";
        $rsh3=mysql_query($sql3); 
    $rsh3=mysql_fetch_array($rsh3);
        $aa03=$rsh3["a03"];
    // $rsh2 is of type "adodb.recordset"
        $sql2="select count(*) as a02 from  plvote where a02=2 and a01=".$rs1["a00"]."";
        $rsh2=mysql_query($sql2);
    $rsh2=mysql_fetch_array($rsh2);
        $aa02=$rsh2["a02"];
    // $rsh1 is of type "adodb.recordset"
        $sql1="select count(*) as a01 from  plvote where a02=1 and a01=".$rs1["a00"]."";
        $rsh1=mysql_query($sql1); 
    $rsh1=mysql_fetch_array($rsh1);
        $aa01=$rsh1["a01"];
    //aa=aa01+aa02+aa03+aa04+aa05
        if ($aa01+$aa02+$aa03+$aa04+$aa05!=0)
        {
          $hand=round((1*$aa01+2*$aa02+3*$aa03+4*$aa04+5*$aa05)/($aa01+$aa02+$aa03+$aa04+$aa05),);
        } 
        if ($hand=="")
        {
          $hand=0;
        } 
        if (!isset($rs1["a05"])==true)
        {
          $rs1["a05"]=0;
        } 
    ?></font><tr class="small"> <td  width="6%" height="21" align="center"    <?  if ($i%2==0) { ?> bgcolor="#F7F7F7" <?     } ?> class="7eng"><?  echo $i+1; ?></td>
    <td width="19%"   <? if ($i%2==0)
    { ?>bgcolor="#eeeeee" <? } ?> class="7eng"> 
    <a href="editplst.asp?a03=<? echo $rs1["a03"]; ?>&amp;i=<? echo $rs1["a05"]; ?>&amp;a02=<?  echo $rs1["a02"]; ?>&amp;a00=<? echo $rs1["a00"]; ?>"><?  echo $rs1["a02"]; ?>&nbsp;</a><font color="gray"> <?  if (!isset($rs1["a05"])==false){
    ?>&lt;<? echo $rs1["a05"]; ?>&gt;<?   } ?> 
     <a href="update.asp?id=3&amp;a00=<?  echo $rs1["a00"]; ?>&amp;a02=<?     echo $rs1["a02"]; ?>"><font color="red">Delete</font> 
                </a></font></td>
                        <td width="31%"  <?     if ($i%2==0)
        {
    ?> bgcolor="#F7F7F7" <?     } ?> class="7eng"> 
                          <?     echo $rs1["a07"]; ?>&nbsp;</td>
                        <td width="17%"  <?     if ($i%2==0)
        {
    ?> bgcolor="#F7F7F7" <?     } ?> class="7eng"><font color="gray"><?     if ($hand==1)
        {
    ?><img src="images/ratings/full.gif" > 
                          <?     } ?> <?     if ($hand==2)
        {
    ?><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" > 
                          <?     } ?> <?     if ($hand==3)
        {
    ?><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" > 
                          <?     } ?> <?     if ($hand==4)
        {
    ?><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" > 
                          <?     } ?> <?     if ($hand==5)
        {
    ?><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" ><img src="images/ratings/full.gif" > 
                          <?     } ?> <br/>&nbsp;&nbsp;<a href="#" onClick="MM_openBrWindow('pyvote.asp?albumid=<?     echo $rs1["a00"]; ?>&amp;album=<?     echo $rs1["a02"]; ?>','Vote','width=470,height=400')">Vote 
                          it !!!! </a></font> </td>
                        <td width="8%"  <?     if ($i%2==0)
        {
    ?> bgcolor="#F7F7F7" <?     } ?> class="7eng" align="center"><?     if (!isset($rs1["a08"])==true)
        {
    ?>0<?  } else{
    ?><?   echo $rs1["a08"]; ?><?  } ?></td><td width="19%" align="center" bgcolor="#F7F7F7" class="7eng"   <?     if ($i%2==0)
     {?>bgcolor="#eeeeee" <?     } ?>> 
     <font color="gray"><a href="#" onClick="javascript:window.open('listen/listen.asp?albumid=<?     echo $rs1["a06"]; ?>&amp;a00=<?     echo $rs1["a03"]; ?>&amp;i=<?     echo $rs1["a05"]; ?>&plstid=<?     echo $rs1["a00"]; ?>','Player','width=480,height=390')">Play</a> 
     </font> </td></tr><? 
        $i=$i+1;
        if ($i>=$MaxPerPage)
        {
          break;
        } 
    $rs1->movenext;
        $hand="";
      } 
      return $function_ret;

    ?> <? 
    function showpage($totalnumber,$maxperpage,$filename)
    {
      if ($totalnumber%$maxperpage==0)
      {
        $n=$totalnumber\$maxperpage;
      }
        else
      {
        $n=$totalnumber\$maxperpage+1;
      } 
      print "<form  method=Post  action=".$filename.">";
      if ($CurrentPage<2)
      {
        print "ALL: ".$totalnumber."Item(s)&nbsp;First Last&nbsp;";
      }
        else
      {
        print "ALL: ".$totalnumber."Item(s)&nbsp;<a href=".$filename."?page=1>First</a>&nbsp;";
        print "<a href=".$filename."?page=".$CurrentPage-1.">Last</a>&nbsp;";
      } 
      if ($n-$currentpage<1)
      {
        print "Next End";
      }
        else
      {
        print "<a href=".$filename."?page=".($CurrentPage+1).">";
        print "Next</a> <a href=".$filename."?page=".$n."&>End</a>";
      }   print "&nbsp;Page:<strong><font color=red>".$CurrentPage."</font>/".$n."</strong>";
      print "&nbsp;<b>".$maxperpage."</b>Item(s)/page ";
    ?> GOTO  <select name='page' size='1' onChange='javascript:submit()'>
     <?   for ($i=1; $i<=$n; $i=$i+1)
      {
    ?> <option value='<?  echo $i; ?>' <? if (intval($Page)==intval($i))
        {
    ?> selected <?  } ?>>No.<?     echo $i; ?></option>
    <?  } ?> </select>
    <? 
      print "</form>";
      return;

    ?>
      

  2.   

    楼主,基本是这样的,有个别的可能要看你的情况改一下,特别是
    asp中的rs1.eof
    在php中是:
    $sql="select count(*) as count from youtable.....";
    $query=mysql_query($sql);
    $data=mysql_fetch_array($query);
    $data[count]==0;