PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
sandy1028
Forum Commoner
Posts: 60 Joined: Thu Jul 26, 2007 3:56 am
Post
by sandy1028 » 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.
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>";
Jade
Forum Regular
Posts: 908 Joined: Sun Dec 29, 2002 5:40 pm
Location: VA
Post
by Jade » Wed Feb 27, 2008 2:54 pm
You can set the header to refresh every 2 minutes if you want it to continually update. Another thing you can do to help is set it so it doesn't cache.
sandy1028
Forum Commoner
Posts: 60 Joined: Thu Jul 26, 2007 3:56 am
Post
by sandy1028 » Thu Feb 28, 2008 9:33 pm
How to open a word document in php. I am using Linux platform. If I add header with no-cache the word document doesnot gets refreshed in Internet Explorer. But in mozilla it is refreshed.
sandy1028
Forum Commoner
Posts: 60 Joined: Thu Jul 26, 2007 3:56 am
Post
by sandy1028 » Mon Mar 03, 2008 12:22 am
Please tell me any other solution to open the document in word file when the data gets refreshed.
When i try to open the word file it opens the word file which was opened for the first time. The values is not dynamic