我试图使用php从mysql数据库中导出我的数据。 普通数据成功导出到Excel,但图像显示不显示错误"链接的图像无法显示。文件可能已被移动,重命名或删除。验证链接点以更正文件和位置"。
<?php
// The function header by sending raw excel
header("Content-type: application/vnd-ms-excel");
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=system_users.xls");
// Add data table
include("config/dbconfig.php");
?>
<!-- Image path in subfolder images -->
<img src="images/reph.png" height="115" width="730">
<table width=70% border="1" class="view" align="center">
<tr><th> No</th>
<th> Name</th>
<th>User Role</th>
<th>User Name</th>
<th>Password</th>
</class> </tr><tr>
<?php
$sno=1;
$query=mysql_query("select * from users ");
$num_rows=mysql_num_rows($query);
if($num_rows>0)
{ while ($fields=mysql_fetch_assoc($query))
{ $sno<=$num_rows;
$pid=$fields['user_id'];
$lname=$fields['lname'];
?>
<td> <?php echo "$sno ";
$sno++; ?></td>
<td> <?php echo $fields['lname']." ".$fields['fname'];?></td>
<td><?php // php code that retrieves image path from the database and prints the image
//echo '<img width="120" height="110" SRC="' .$fields['image'] . '" alt="Image failed to load " />';
?></td>
<td> <?php echo $fields['role'];?></td>
<td> <?php echo $fields['username'];?></td>
<td> <?php echo $fields['password'];?></td>
</tr>
<?php
}//closing the while loop
}//closing the if statement
echo '</table>';
?>
&#13;