Forum


Replies: 1   Views: 3629
Mysql source print in an word template
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by kpholland  · 28-02-2012 - 15:22

I want to read some data from a Mysql table. But how do i print it to the PHPDOCX template?
We have PHPDOCX pro version.

//////////////// mine test code
$SQL="SELECT * FROM TABLE";
$result= mysql_query($SQL);
if (mysql_num_rows($result) >= 1) {
while($row = mysql_fetch_array( $result)) {
$NAAM = $row['NAAM'];
$NOTE = $row['NOTE'];
}
}

$docx->addTemplate('../files/Template.docx');
$docx->addTemplateVariable('NOTE', ''.$NOTE.'');
$docx->createDocxAndDownload('File');