Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?php
// create database connection
include("includes/connection.php");
// call data to be viewed
$sql="SELECT * FROM tblProfileList ORDER BY tblProfileList.companyName ASC";
// submit the query
$rs=odbc_exec($conn,$sql);
// if query is invalid do this
if (!$rs)
{exit("Error in SQL");}
// if query is valid do this
while (odbc_fetch_row($rs))
{
$id=odbc_result($rs,"ID");
$compName=odbc_result($rs,"companyName");
$compContact=odbc_result($rs,"companyContact");
$nsContacts=odbc_result($rs,"nsContacts");
$personal=odbc_result($rs,"personal");
$overview=odbc_result($rs,"overview");
$majorLocations=odbc_result($rs,"majorLocations");
$systemTraffic=odbc_result($rs,"systemTraffic");
$mjrIssOpps=odbc_result($rs,"mjrIssOpps");
$notes=odbc_result($rs,"notes");
$compInfoUpdated=odbc_result($rs,"compInfoUpdated");
$persInfoUpdated=odbc_result($rs,"persInfoUpdated");
}
//odbc_close($conn);
// create a reference to a new COM component (Word)
$word = new COM("word.application") or die("Can't start Word!");
// print the version of Word that's now in use
//echo "Loading Word, v. {$word->Version}<br>";
// set the visibility of the application to 0 (false)
// to open the application in the forefront, use 1 (true)
$word->Visible = 0;
// create a new document in Word
$word->Documents->Add();
// add text to the new document
$word->Selection->TypeText("$id $compName");
//save the document in the Windows temp directory
$word->Documents[1]->SaveAs("/xampp/htdocs/profiles/$compName.doc");
// close the connection to the COM component
$word->Quit();
// print another message to the screen
//echo "Check for the file...";
?>
<script type="text/javascript">
window.location="[URL unfurl="true"]http://www.mypage.com/";[/URL]
</script>
header("location:[URL unfurl="true"]http:///www.domain.com/anotherpage.html");[/URL]
// create a reference to a new COM component (Word)
$word = new COM("word.application") or die("Can't start Word!");
// print the version of Word that's now in use
//echo "Loading Word, v. {$word->Version}<br>";
// set the visibility of the application to 0 (false)
// to open the application in the forefront, use 1 (true)
$word->Visible = 0;
// create a new document in Word
$word->Documents->Add();
// add text to the new document
$word->Selection->TypeText("$compName
$compContact
$nsContacts
Personal: $personal
Overview: $overview
Major Locations: $majorLocations
System Traffic: $systemTraffic
Major Issue and Opportunities: $mjrIssOpps
Notes: $notes");
//save the document in the web directory
$word->Documents[1]->SaveAs("/xampp/htdocs/profiles/$compName.doc");
// close the connection to the COM component
$word->Quit();
$word->Selection->PageSetup->LeftMargin = '2"'; //2 inches
$word->Selection->PageSetup->RightMargin = '2"';
$word->Selection->Font->Name = 'Arial';
$word->Selection->Font->Size = 8;
<?php
// create database connection
include("includes/connection.php");
// call data to be viewed
$id=$_GET[id];
$sql="SELECT * FROM tblProfileList WHERE ID = $id";
// submit the query
$rs=odbc_exec($conn,$sql);
// if query is invalid do this
if (!$rs)
{exit("Error in SQL");}
// if query is valid do this
while (odbc_fetch_row($rs))
{
$id=odbc_result($rs,"ID");
$compName=odbc_result($rs,"companyName");
$compContact=odbc_result($rs,"companyContact");
$nsContacts=odbc_result($rs,"nsContacts");
$personal=odbc_result($rs,"personal");
$overview=odbc_result($rs,"overview");
$majorLocations=odbc_result($rs,"majorLocations");
$systemTraffic=odbc_result($rs,"systemTraffic");
$mjrIssOpps=odbc_result($rs,"mjrIssOpps");
$notes=odbc_result($rs,"notes");
$compInfoUpdated=odbc_result($rs,"compInfoUpdated");
$persInfoUpdated=odbc_result($rs,"persInfoUpdated");
}
odbc_close($conn);
// create a reference to a new COM component (Word)
$word = new COM("word.application") or die("Can't start Word!");
// print the version of Word that's now in use
//echo "Loading Word, v. {$word->Version}<br>";
// specify the MS Word template document ( with bookmarks inside )
$template_file = "G:/Grpratt/Profiles/profileTemplate08.doc";
// get the bookmark and create a new MS Word Range (to enable text substitution)
$compName = "compName";
$objBookmark = $word->ActiveDocument->Bookmarks($compName);
$range = $objBookmark->Range;
// now substitute the bookmark with actual value
$range->Text = $compName;
// set the visibility of the application to 0 (false)
// to open the application in the forefront, use 1 (true)
$word->Visible = 0;
// create a new document in Word
$word->Documents->Add();
// set the margins
$word->Selection->PageSetup->LeftMargin = '1"'; //1 inch
$word->Selection->PageSetup->TopMargin = '1"';
$word->Selection->PageSetup->RightMargin = '1"';
$word->Selection->PageSetup->BottomMargin = '1"';
// set the font
$word->Selection->Font->Name = 'Arial';
$word->Selection->Font->Size = 10;
// add text to the new document
/*$word->Selection->TypeText("$compName
$compLoc
$compContact
NS CONTACT:
$nsContacts
PERSONAL:
$personal
OVERVIEW:
$overview
MAJOR LOCATIONS:
$majorLocations
SYSTEM TRAFFIC:
$systemTraffic
MAJOR ISSUES AND OPPORTUNITIES:
$mjrIssOpps
Notes:
$notes
");*/
//save the document in the web directory
//$word->Documents[1]->SaveAs("/xampp/htdocs/profiles/$compName.doc");
$word->Documents[1]->SaveAs("G:/Grpratt/Profiles/generated-Word-Profiles/$compName.doc");
// close the connection to the COM component
$word->Quit();
// Redirect browser
header("location:[URL unfurl="true"]http://localhost/profiles/profilelist.php");[/URL]
?>
// create a new document in Word
$word->Documents->Add();