duanlan8763 2015-07-23 17:50
浏览 32

如何在mysql中检索员工id的所有相关记录

Am trying to print all the records mapped for the eid, but am getting error and unexpected end of file. ' + ' font-weight: bold; border: 1 solid #0000FF" ' + 'onClick="javascript:window.print()"> </form>'); } // End hide -->

  <?php

  //$v1=$_GET['id'];
  //echo $v1;
  $con = @mysql_connect("localhost","root","admin");
  if(!$con)
   {
    die("connection failed:".mysql_error());
       }
     $eeid=$_GET['id'];
    $sql="select * from employee where eid=$eeid";
      $rs=mysql_query($sql);

     while ($row=mysql_fetch_array($rs))
    {
     $eid = $row['id'];
     $ename = $row['name'];
     $edesign=$row['designation'];

       <tr>
           <td><p align="center"><font face="Verdana" size="2"           
        color="#0000FF">&nbsp;<? echo $eid; ?>&nbsp;</td>
          <td><p align="center"><font face="Verdana" size="2"           
        color="#0000FF">&nbsp;<? echo $ename; ?>&nbsp;</td>

     <td><p align="center"><font face="Verdana" size="2"        
     color="#0000FF">&nbsp;<? echo $edesign; ?>&nbsp;</td>
     <td><p align="center">
     <form name="errorpage" metho="POST" action ="emplyee.php">
     Enter the emp  code : <input type="text" name="id">
     <input type="submit" name="submit" value="Lock">
     </form>
     </td> 
     </tr>
      }
     mysql_close();
     ?>
     </body>
     </html>
  • 写回答

1条回答 默认 最新

  • dongshi6528 2015-07-23 17:57
    关注

    You are missing endings to the php. The html will not run in a php script without them

      //$v1=$_GET['id'];
      //echo $v1;
     $con = @mysql_connect("localhost","root","admin");
     if(!$con)
     {
    die("connection failed:".mysql_error());
       }
     $eeid=$_GET['id'];
    $sql="select * from employee where eid=$eeid";
      $rs=mysql_query($sql);
    
     while ($row=mysql_fetch_array($rs))
    {
     $eid = $row['id'];
     $ename = $row['name'];
     $edesign=$row['designation'];
     ?>
       <tr>
           <td><p align="center"><font face="Verdana" size="2"           
        color="#0000FF">&nbsp;<? echo $eid; ?>&nbsp;</td>
          <td><p align="center"><font face="Verdana" size="2"           
        color="#0000FF">&nbsp;<? echo $ename; ?>&nbsp;</td>
    
     <td><p align="center"><font face="Verdana" size="2"        
     color="#0000FF">&nbsp;<? echo $edesign; ?>&nbsp;</td>
     <td><p align="center">
     <form name="errorpage" metho="POST" action ="emplyee.php">
     Enter the emp  code : <input type="text" name="id">
     <input type="submit" name="submit" value="Lock">
     </form>
     </td> 
     </tr>
     <?php
      }
     mysql_close();
     ?>
     </body>
     </html>
    

    Try this

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统