displaying mysql data in microsoft word using php

i am using  a php program  which displays data(retrieved from mysql database)  in microosoft word. i am using a linux server. using headers i am mentioning the word related header info. and echoing the data.
But actually the problem while displaying this content microsoft word application asks for converter to be installed and try to install if we cancel the installation it displays the data . Is there any way to  just putting text retrieved from database and displaying it as it is in word with out any further installation queryies and charset quries.
for reference i am  giving the code  i have used.

--------------------
my application requires just output the content from database in a word file using php. iam using a linux server.



<?php
 
ob_start();
 
session_start();
 
if((!session_is_registered(myusername) ) && (!session_is_registered(mypassword))){
 
header("location:index.html");
 
}
 
?>
 
<?php $id =$_SESSION['uid'];$uname =$_SESSION['name'];$FC =$_SESSION['FCAT'];$C =$_SESSION['myusername'];$C1 =$_SESSION['CLIENT'];
 
 
 
$EM=$_SESSION['EMAIL'] ;
 
if(($FC!=8)&&($FC!=9))
 
header("location:index.html");
 
$display=1;include("include.php");
 
$SNO =$reqid;
 
if($display)
 
{
 
 
 
if($FC==9)
 
{
 
 
 
 
 
 
 
$query  = "SELECT RES_DET from
 
xxxxx S , xxx R
 
 WHERE 
 
 S. ASSIGN =1
 
 AND 
 
 
 
S.RQID ='$SNO'
 
 
 
 
 
AND S.RESID ='$resid'
 
 
 
and S.RESID=R.FRID
 
 ";}
 
else
 
{
 
 
 
$query  = "SELECT RES_DET from
 
 xxxx S ,xxxx R
 
 WHERE  
 
 
 
 S.ASSIGN =1  AND
 
 
 
S.RQID ='$SNO'
 
AND S.RESID ='$resid'
 
 
 
 
 
 ";
 
 
 
 
 
 
 
}
 
$result = mysql_query($query)or die( "<center><h3><B>".mysql_error()."<br><A HREF='javascript:javascript:history.go(-1)'>Click here to go back to previous page<br><Br><Br></A>");
 
 
 
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
 
{
 
$RES_DET =$row['RES_DET'];
 
}
 
}
 
?>
 
 
 
<?php
 
//$filename = "temp.txt";
 
 
 
 
 
 
 
$length = strlen($imagedata);
 
 
 
$mm_type="application/ms-word";
 
 
 
/*
 
header("Cache-Control: public, must-revalidate");
 
header("Pragma: hack"); // WTF? oh well, it works...
 
header("Content-Type:   $mm_type;charset=utf-8");
 
//header("Content-Length: " .(string)(filesize($myFile)) );
 
//header('Content-Disposition: attachment; filename="'.$filename.'"');
 
header("Content-Transfer-Encoding: binary\n");
 
//include("test.html");*/
 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 
header("Content-type: application/msword;charset=utf-8");
 
header("Content-Disposition: attachment; filename=Resume.doc");
 
header("Pragma: no-cache");
 
header('Content-Transfer-Encoding: none');
 
header("Expires: 0");
 
 
 
 echo"$RES_DET";
 
 
 
//And here echo the document's content instead of writing it into a file on your server
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
// echo"the file name is : ";
 
 ob_end_flush();
 
		mysql_close($con);
 
?>

Open in new window

srinut31Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
it is very risky to do this requirement on Linux + word document... may be you can look for some plug ins / libraries in PEAR or other packages...to do this... but it is easy to do for .xls, pdf.,

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
srinut31Author Commented:
hi  friend,
you know phpmyadmin software which exports  mysql database in terms of word , excel, sql , and other formats,  It can easily export any data in required format. with getting error. in my application i tried to disply out put in word file. but  it is asking for word converter and try to fetch files from office -2003  installtion cd.
Is there any possiblility of  displaying out put in microsoft word  of a php program  fetching data from database mysql. and  the application is on linux server
0
Loganathan NatarajanLAMP DeveloperCommented:
may be you can look for some plug ins / libraries in PEAR or other packages..

also take a look at in the /phpmyadmin itself how they do the export to WORD???

might have some libraries or packages to do that... try to use ..if you find that is best one.,

0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

srinut31Author Commented:
Thanks to you am doing same. when click on word file link in browser ms word asking for import a file from
msword pro11.msi .
    i  say no than only its opening . i dont want that message to see in browsers man
     
0
Loganathan NatarajanLAMP DeveloperCommented:
if you don't have ms-word support (stream, open office or other) on linux server... it may display some errors,
0
srinut31Author Commented:
in server that support is there  but client side is want to install the some package man  
0
Loganathan NatarajanLAMP DeveloperCommented:
i tried with more data & more table structure data... it does not display as i wanted ... so.. i just want to point out ... it won't be accurate or exact as we want the report ...

infact my phpmyadmin is in windows... i did not tryout in linux
0
Loganathan NatarajanLAMP DeveloperCommented:
oh... check in the client whether do you have .doc support (ms-word installed or check the exported / created .doc file is also valid..
0
srinut31Author Commented:
i am testing on client system . i have server also
0
Loganathan NatarajanLAMP DeveloperCommented:
ok....,
0
srinut31Author Commented:
how can i see in pdf format can you tel me  logudotcom
0
Loganathan NatarajanLAMP DeveloperCommented:
you mean, do you want to go for pdf creation file instead of .doc format?
0
srinut31Author Commented:
ya , we had problem with .doc format from our client side can you give how can i do
0
srinut31Author Commented:
i got it for pdf still our client wants to see on .doc format .this is for now bout i need for .doc only
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.