Am trying to export my data along side images from mysql database using php. The plain data is successfully exported to excel but the images donot display rather display error "the linked image cannot be displayed.The file may have been moved,renamed or deleted.Verify link points to correct file and location".
<?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>';
?>
</div>