在我的程序中,我创建了一个可滚动的表,就滚动条显示、返回正确的数据等而言,一切正常。
奇怪的是,我不知道为什么,在表的标题上方,“echo”这个词重复了 7 次,每条记录返回一个。我的代码显然有一些缺陷,但我无法找到它,感谢任何帮助
<?php
echo "<div class='scrollableContainer'>";
echo "<div style=' height: 125px; width: 535px; font-size: 10px; overflow: auto;'>";
echo "<table class='referrals scrollable'>";
echo "<thead><tr>
<th class='date'>Date</th>
<th class='name'>Student Name</th>
<th class='email'>Email</th>
<th class='phone'>Phone</th>
<th class='status'>Status</th>
echo </tr></thead>";
$query2 = "select * from students where referred_by ='$referral_id_to_use'";
$result2 = mysql_query($query2);
$num_rows = mysql_num_rows($result2);
if($num_rows>0){
while ($row = mysql_fetch_array($result2))
{
extract($row);
$student_name=$first_name.' '.$last_name;
if($current_status=1)
{
$student_status="Active";
}else{
$student_status="Inactive";
}
echo "<tr>\n
<td class='date'><div>$date_joined</div></td>
<td class='name'><div>$student_name</div></td>
<td class='email'><div>$emailaddress</div></td>
<td class='phone'><div>$phone_number</div></td>
<td class='status'><div>$student_status</div></td>
echo </tr>";
}
}
echo "</table>";
echo "</div>";
echo "</div>";
?>
额外的回声行再次出现在表格标题上方。
谢谢