I am trying to set up an export button on a website that will export some information from a database and put it into a .doc file. I'm currently doing this with:
$filename = "File.doc";
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=$filename");
echo "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\"><body><img src='the_img.png' width='250px'><br><br><b style='font-size: 40px;'><u><center>Header</center></u></b><br><br><ol>";
$fileData = "SELECT `Songs` FROM `table`;";
$info = $con->query($fileData);
while ($the_row = $info->fetch_assoc()) {
$content = $the_row["column"];
}
$arr = explode("|", $content);
for($i = 0; $i < count($arr); $i++){
echo "<li>" . $arr[$i] . "</li>";
}
echo "</ol></body></html>";
mysqli_close($con);
exit;
When it exports the .doc file it successfully opens in Microsoft Word, however the image appears to be broken until you enter edit mode. Once you're in edit mode the image has no specific size set. Any suggestions?