Word document
Posted: Wed Feb 27, 2008 1:19 am
How to write the php script to open in a word format. I tried the code below which opens in word document but the contents are not dynamic.
The data collected in the function is fetched from the database which is updated for every 2 minutes.
The word page is not getting refreshed.
The data collected in the function is fetched from the database which is updated for every 2 minutes.
The word page is not getting refreshed.
Code: Select all
$rec=clusteravail();
array_shift($rec);
header("Content-type: application/msword");
echo "<html><head><title>REPORT</title><meta http-equiv=\"refresh\" content=\"100\"></head><body bgcolor=\"#FFFFFF\" text=\"#000000\"><TABLE BORDER=2 CELLPADDING=4 width=\"100%\"><TR><TH COLSPAN=8>DATE AS ON 2008-02-27</TH></TR><TR><TH COLSPAN=8>Head and CLIENT NODE Status of Garuda Network</TH></TR><TR><TD>SL NO</TD><TD>CLIENT NODE NAME</TD><TD>IP ADDRESS</TD><TD>HEAD NODE NAME</TD><TD>START TIME</TD><TD>END TIME</TD><TD>DURATION</TD></TR>";
for($i=0;$i<=count($rec);$i++){
$data=split("#",$rec[$i]);
echo "<tr>";
echo "<td>$i</td>";
echo "<td>$data[0]</td>";
echo "<td>$data[1]</td>";
echo "<td>$data[2]</td>";
echo "<td>$data[3]</td>";
echo "<td>$data[4]</td>";
echo "<td>$data[5]</td>";
}
echo "</tr></table></body></html>";