PawCom Application Note 102: Referencing PawCom with PHP ======================================================== 10/5/2005 NOTE: PawCom exposes several properties using standard COM array-style access. In PHP4 you may use PHP array syntax to read/write such a property, but only a single dimension is allowed. Unfortunately this does not let you access the PawCom multi-dimensional properties. This deficiency in PHP4 has been resolved in PHP5, which allows you to access multi-dimensional COM properties. Therefore, if you want to use PHP with PawCom you should use PHP5. -------------------------------------------------------------------------------- Here is a simple example that illustrates accessing PawCom from PHP: Connect("I:\PEACHW\Bcs"); // check if connection was successful if($Status==$bStatusOK) { // create an instance of the CompanyInformation object $oInfo = new COM("PAW.CompanyInformation"); // open the Company INformation file $Status = $oInfo->OpenFile(); // check that open was successful if($Status==$bStatusOK) { // get the first and only record $oInfo->StepFirst(); // read the company name into a variable for use by using the function $CompanyName = $oInfo->CompanyName(); echo "
The Company Name is $CompanyName"; // you could change the company name like this by storing the new name in the property $oInfo->CompanyName="Bellweather Garden Supplies"; // use the update function to write the changed information to btrieve $Status=$oInfo->Update(); if($Status==$bStatusOK) echo "
Company name was changed to $oInfo->CompanyName"; else echo "
Status = $Status - Update not completed for Company Information"; // Close the company info file $oInfo->CloseFile(); // remove the object unset($oInfo); } /* end of if */ else /* openfile was not successful */ { echo "
Status = $Status - Cannot Open Company Information"; } // disconnect from betrieve $bstatus=$oBtrieve->Disconnect(); } /* end of if successful btrieve connection */ else { echo "
Status = $Status - Cannot Connect to Peachtree data"; } // remove the object unset($oBtrieve); ?>