对于初学者问题,我很抱歉,我尝试从数据库中检索数据并以表格格式显示。但只打印表头,而不是实际值。 count
变量回显2表示数据存在并正确检索。有人可以帮忙吗?
<?php
include 'connect.php';
error_reporting(E_ALL ^ E_DEPRECATED);
error_reporting(E_ERROR | E_PARSE);
$sql="SELECT * FROM `resources` as r INNER JOIN `project_resources` as pr
ON r.res_id =pr.res_id WHERE project_id='$_POST[project_id]'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($result === FALSE) {
die(mysql_error());
}
echo "$count";
echo '<table>
<tr>
<th>Resource ID</th>
<th>Resource Name</th>
<th>Email</th>
<th>Phone Number</th>
<th>Reporting Manager</th>
<th>Role</th>
<th>Designation</th>
</tr>';
while ($row = mysql_fetch_array($result)) {
echo '
<tr>
<td>'.$row['res_id'].'</td>
<td>'.$row['res_name'].'</td>
<td>'.$row['email'].'</td>
<td>'.$row['phone_number'].'</td>
<td>'.$row['reporting_manager'].'</td>
<td>'.$row['role'].'</td>
<td>'.$row['designation'].'</td>
</tr>';
}
echo '
</table>';
?>