该代码在几页上运行良好,并显示某种警告,例如“mysql_num_rows() 期望参数 1 是资源,C:\wamp\www 中给出的布尔值”......它总是让我感到困惑,因为它适用于某些页面和在某些时候显示一条警告消息,这让我很沮丧......请帮助......
<?php
$emp_id=$_SESSION['username'];
$s=mysql_query("select semester from faculty_advisor where emp_id = '$emp_id' ");
echo $s; //just to check if am getting the correct value
$subject=mysql_query("select * from subject_list where semester=$s");
$numrows=mysql_num_rows($subject);
if($numrows!=0)
{
while($row=mysql_fetch_array($numrows))
{
?>
<td align="center"><?php echo $row['sid']; ?></td>
<td align="center"><?php echo $row['subject_name']; ?></td>
<td align="center"><?php echo "<a class='tooltip' href=\"fac_adv_reg_confrm.php?uid=".$row['sid']."\">Edit<span>Edit User Details</span></a>"?></td>
<?php
}
}
else
{
die('Error: ' . mysql_error());
}
?>