我试图打印为eid映射的所有记录,但是收到错误并意外结束文件。 ' +' font-weight:bold;边界:1个固体#0000FF" ' +' onClick =" javascript:window.print()"> < /形式>&#39); } //结束隐藏 - >
<?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"> <? echo $eid; ?> </td>
<td><p align="center"><font face="Verdana" size="2"
color="#0000FF"> <? echo $ename; ?> </td>
<td><p align="center"><font face="Verdana" size="2"
color="#0000FF"> <? echo $edesign; ?> </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>
答案 0 :(得分:0)
你缺少对php的结局。如果没有它们,html将无法在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"> <? echo $eid; ?> </td>
<td><p align="center"><font face="Verdana" size="2"
color="#0000FF"> <? echo $ename; ?> </td>
<td><p align="center"><font face="Verdana" size="2"
color="#0000FF"> <? echo $edesign; ?> </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>
试试这个