Discuss PHP COM for access in the PHP Development forum on Dev Shed. PHP COM for access PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
Posts: 1,173
Time spent in forums: 3 Days 7 h 45 m 43 sec
Reputation Power: 14
PHP COM for access
Seem to be having permissions trouble (best guess) getting some com stuff to work.
PHP Code:
$db = new COM("ADODB.Connection")
or die("Could not start ADO");
$db->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\accessDB\testDB.mdb;")
or die("Could not open connection");
I get "Could not open connection". The database file permissions are full control/everyone. in dcomcnfg, everyone has access to launch apps and special access in default configuration permissions. and everyone has full control on the folder as well.
This is 2k adv server btw, intel, newest php version.
In the path, it cuts out the backslashes , but they're there =)
__________________ David Fells
If my post helped you, please click the above my post and leave a comment. Thanks
Posts: 5,551
Time spent in forums: 2 Months 2 Weeks 15 h 7 m 7 sec
Reputation Power: 3285
My guess is that since you said devshed it cutting the back slashes, you are using something like this with a double backslash before the filename to avoid php thinking \t is a tab.
$db->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\accessDB\\testDB.mdb;");
What you need to do, is use double backslashes everywhere, or use single quotes, so php will actually use the \ literally rather than take them out as escape characters.
PHP Code:
$db->Open('Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\inetpub\\wwwroot\\accessDB\\testDB.mdb;');
Posts: 790
Time spent in forums: 10 h 29 m 56 sec
Reputation Power: 13
I was able to connect to and query fields from an Access DB using the following code.
PHP Code:
$db = new COM("ADODB.Connection");
$db->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\inetpub\\wwwroot\\myDB\\JobSearch.mdb");
$rs = $db->execute("SELECT * FROM company");
You may be able to get the results you're looking for by adding the $rs->movenext() to your while loop. The way you have it coded right now, it's only going to return the first record every time it loops through the recordset. If the field you're trying to print happens to be blank in that first record, you're not going to get anything.