Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP & Mas90 Connection

Status
Not open for further replies.

GabrielU

Programmer
Apr 5, 2004
1
US
Reviewing all of the documents provided by this forum I was unable to find the connection which I was looking to make. I figure that someone else may find themselves in the position that I was in and I therefore decided that posting my solution would be helpful.

First, I was using Windows XP Home Edition, with Apache Server 1.3 (or so...), PHP 4 (or so...).

Second, a quick and VITAL/CRUCIAL tip is the way in which you decide to run Apache. During a normal setup Apache is installed to run as a service which I was unable to link to Mas90. You must get to your services control panel (START -> Control Panel -> Administrative Tools -> Services) and stop the "Apache" service. Within its properties you should set "Startup type" to "Manual".

You should now execute Apache.exe like you would any desktop application. My version was located at: "C:\Apache Group\Apache". Having the open window is the only way to connect to Mas90 properly. Just minimize it!

Now, make sure that SOTAMAS90 is available as a system DSN. Here is a sample PHP script to connect to the Mas90:

<?php
$conn= new COM("ADODB.Connection") or die("Could not execute COM object.<br>\n");

$conn->ConnectionTimeout = "900"; //-15 min. timeout
$conn->CommandTimeout = "900"; //-15 min. timeout
set_time_limit(900); //-15 min. timeout

$conn->Open("DSN=SOTAMAS90;UID=***;PWD=***;Directory=W:\\MAS90;Company=***;LogFile=\\PVXODB32.LOG;SERVER=NotTheServer"); //-W:\\ is a mapped network drive

$headersql = "Select * FROM SO5_InvoiceDataEntryHeader";

$headerresults = $conn->Execute($headersql);
$s = $headerresults->fields->Count();

while(!$headerresults->eof) {
for( $i=0; $i<$s; $i++ ) {
print $headerresults->fields[$i]->name . ": " . $headerresults->fields[$i]->value . "<br>\n";
}//for( $i=0; $i<$s; $i++ )
print "<br><br>\n\n";
$headerresults->movenext();
}//while(!$headerresults->eof)

$conn->Close();
?>

I hope that this helps someone and sorry if I wasn't too informative on certain parts or something I've provided isn't completely correct. It did work perfectly for me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top