PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 3rd, 2002, 02:02 PM
crazytrain81 crazytrain81 is offline
Always Learning
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2002
Location: Port Neches, TX, USA
Posts: 1,173 crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 7 h 45 m 43 sec
Reputation Power: 12
Send a message via AIM to crazytrain81 Send a message via MSN to crazytrain81
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

Reply With Quote
  #2  
Old December 3rd, 2002, 02:48 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2001
Location: Ft Myers, FL
Posts: 4,667 kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)kicken User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1Folding Points: 221067 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 4 Weeks 1 Day 18 h 20 m 54 sec
Reputation Power: 1409
Send a message via ICQ to kicken Send a message via AIM to kicken Send a message via MSN to kicken
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;'); 

Reply With Quote
  #3  
Old December 3rd, 2002, 02:56 PM
crazytrain81 crazytrain81 is offline
Always Learning
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2002
Location: Port Neches, TX, USA
Posts: 1,173 crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 7 h 45 m 43 sec
Reputation Power: 12
Send a message via AIM to crazytrain81 Send a message via MSN to crazytrain81
That wasn't the problem, I had the code there correct in my program, it was a permissions thing. New problem though =()

I run a query but can't print any results.

PHP Code:
 $db = new COM("ADODB.Connection"
      or die(
"Could not start ADO"); 
$db->Open("testDB"); 
      or die(
"Could not open connection");

$rs $db->execute("SELECT * FROM news")
          or die(
"Query Failed");
            
while (!
$rs->EOF) {
      
$user $rs->Fields('user');
        print 
$user->value;
}

$rs->close();
$db->close(); 


No output. There is 1 row of data in the table.

Reply With Quote
  #4  
Old December 3rd, 2002, 03:54 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,441 pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level)pabloj User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Months 5 Days 22 h 55 m 41 sec
Reputation Power: 532
Why don't you simply use php's odbc functions? They seem to work well!

Reply With Quote
  #5  
Old December 3rd, 2002, 04:07 PM
crazytrain81 crazytrain81 is offline
Always Learning
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2002
Location: Port Neches, TX, USA
Posts: 1,173 crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level)crazytrain81 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 7 h 45 m 43 sec
Reputation Power: 12
Send a message via AIM to crazytrain81 Send a message via MSN to crazytrain81
never used them before, and i'm familiar with ADO from working in asp

Reply With Quote
  #6  
Old December 3rd, 2002, 07:32 PM
micros_bytes micros_bytes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2002
Posts: 790 micros_bytes User rank is Corporal (100 - 500 Reputation Level)micros_bytes User rank is Corporal (100 - 500 Reputation Level)micros_bytes User rank is Corporal (100 - 500 Reputation Level)micros_bytes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 10 h 29 m 56 sec
Reputation Power: 11
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");

 while (!
$rs->EOF) {
      
$user $rs->Fields('Company');
        print 
$user->value."<br>\r\n";
          
$rs->movenext();
}
$rs->close();
$db->close(); 


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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP COM for access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek