473,671 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using PHP to pull from MS Access DB

I've been trying to create a simple (I hope) PHP application to send
emails to a membership list. I have yet to successfully connect to my
database to pull the names and email addresses. I'm running XP Pro,
PHP Version 4.3.2, Access 2000. I have created an ODBC System DNS
connection to the database file I want to access, And I get this error:

Warning: SQL error: , SQL state 00000 in SQLConnect in connecttodb.php
on line 2
Whoops! Could Not Connect to ODBC Database!

Here is my code:

<?php
$odbc = odbc_connect ('DFWMembership DB', '', '') or die('Whoops! Could
Not Connect to ODBC Database!');
?>

I'm a total novice at this, so any help you can provide would be really
appreciated.

Chad Lupkes
Seattle, Washington

Nov 22 '05 #1
12 6283
as you've probably noticed, "whoops!" doesn't get you too far. i think if
you output the actual error, you'd probably be able to figure it out by
yourself. as for those here, "whoops!" means jack-squat.

(dfw = dallas/fort worth? just curious)
"chadlupkes " <ch********@gma il.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
| I've been trying to create a simple (I hope) PHP application to send
| emails to a membership list. I have yet to successfully connect to my
| database to pull the names and email addresses. I'm running XP Pro,
| PHP Version 4.3.2, Access 2000. I have created an ODBC System DNS
| connection to the database file I want to access, And I get this error:
|
| Warning: SQL error: , SQL state 00000 in SQLConnect in connecttodb.php
| on line 2
| Whoops! Could Not Connect to ODBC Database!
|
| Here is my code:
|
| <?php
| $odbc = odbc_connect ('DFWMembership DB', '', '') or die('Whoops! Could
| Not Connect to ODBC Database!');
| ?>
|
| I'm a total novice at this, so any help you can provide would be really
| appreciated.
|
| Chad Lupkes
| Seattle, Washington
|
Nov 22 '05 #2
steve wrote:
as you've probably noticed, "whoops!" doesn't get you too far. i
think if you output the actual error, you'd probably be able to
figure it out by yourself. as for those here, "whoops!" means
jack-squat.


And "whoops!" isn't a word you want to hear from a sysadmin who's
upgrading a critical system. Especially if followed by "you have
backups of this, right?"

--
Kim André Akerĝ
- ki******@NOSPAM betadome.com
(remove NOSPAM to contact me directly)
Nov 22 '05 #3

"Kim André Akerĝ" <ki******@NOSPA Mbetadome.com> wrote in message
news:3u******** *****@individua l.net...

| And "whoops!" isn't a word you want to hear from a sysadmin who's
| upgrading a critical system. Especially if followed by "you have
| backups of this, right?"

roflmao
Nov 22 '05 #4
So, saying I'm a total novice didn't make it clear enough, eh?

How do I output the actual error?

(DFW - Democracy for Washington)

Nov 23 '05 #5
novice implies ignorance and not stupidity. while there is nothing wrong
with the former, the latter i find is hard to excuse.

i bet if you were to google "php odbc error help", you'd find your answer.
or if you went to php.net and searched for "odbc error", you'd likewise come
up with odbc_error() and odbc_errormsg()

searching for and finding help is a methodology employed by anyone with a
problem. as we all have them, none are novices. asking for help with novice
questions when the answer(s) are so pervasive, prevelent, and otherwise
readily available is...well...stu pid. what's worse is doing so and then
being smug at the same time...eh! but, perhaps i just mis-read your tone in
this media.

(there is no d in w, but thanks for curing my curiosity)
"chadlupkes " <ch********@gma il.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
| So, saying I'm a total novice didn't make it clear enough, eh?
|
| How do I output the actual error?
|
| (DFW - Democracy for Washington)
|
Nov 23 '05 #6
You mis-read. I was smiling.

I've been looking through the thousands of results from searches like
the ones you recommended, and I've been trying a lot of what I find.
Every step just leads to more and more questions that I can't find
answers to. So, I appreciate the direct help.

I'm trying to create a very simple script that will pull email
addresses from an existing database and export them with message
content to my local smtp server. To do that, I've read that I need to
set up an System DNS to the database file, which I've done according to
all the directions I can find. Now I'm trying to test the connection.

The errors I'm getting are leading me into another maze of search
results, and they all seem to be for people who have a basic
understanding of what is happening. Or the tutorials assume that
everything works just as they describe. So when things don't work, I
ask for help.

Chad

Nov 23 '05 #7
Here's the latest update:

<?php
$connectionstri ng = odbc_connect("D FWDB", "chad", "dfw");
if (odbc_error())
{
echo odbc_errormsg($ connectionstrin g);
}
odbc_close($con nectionstring);
?>

This is what comes out:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The
Microsoft Jet database engine cannot open the file '(unknown)'. It is
already opened exclusively by another user, or you need permission to
view its data., SQL state S1000 in SQLConnect in
C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 2

Warning: odbc_errormsg() : supplied argument is not a valid ODBC-Link
resource in C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 5

Warning: odbc_close(): supplied argument is not a valid ODBC-Link
resource in C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 7

--
This doesn't make sense. I don't have any other connections open to
the database, although I can't get the ODBC logfile to work to check.
I haven't set any restrictions on access, since this is all on my local
machine, although I'm not sure what permissions I need to set. And the
odbc_ functions just seem to fail.

I'm really lost.

Nov 23 '05 #8
ok, smiling one. ;^)

usually, one db error will cascade multiple errors in php since most db
functions rely on a resource provided by another db function. anyway...what
you've got is a failure to connect and yet you continue to try to use other
functions that rely on that connection which in turn throws errors number 2
and 3.

your literal problem is that access (shitty as it is) stores its data in a
file. when php tries to open that db/file, your pc tries to access it as
IUSR_<computer name here>...that is, if you're using IIS (incredibly
insecure server). you must allow read/write permissions for that user on the
directory in which your mdb resides.

btw, you do *NOT* need a dsn to connect to the db, as a standard odbc
connection string in the form of:

"Driver={Micros oft Access Driver
(*.mdb)};Dbq=C: \mydatabase.mdb ;Uid=Admin;Pwd= ;"

will work just fine.

(look at http://www.connectionstrings.com/ for most common connection
strings)
does that explain things to your satisfaction?
| Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The
| Microsoft Jet database engine cannot open the file '(unknown)'. It is
| already opened exclusively by another user, or you need permission to
| view its data., SQL state S1000 in SQLConnect in
| C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 2
|
| Warning: odbc_errormsg() : supplied argument is not a valid ODBC-Link
| resource in C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 5
|
| Warning: odbc_close(): supplied argument is not a valid ODBC-Link
| resource in C:\Inetpub\wwwr oot\politics\DF W\connecttodb.p hp on line 7
|
| --
| This doesn't make sense. I don't have any other connections open to
| the database, although I can't get the ODBC logfile to work to check.
| I haven't set any restrictions on access, since this is all on my local
| machine, although I'm not sure what permissions I need to set. And the
| odbc_ functions just seem to fail.
|
| I'm really lost.
|
Nov 23 '05 #9
Well, well. Yes, that did it. And none of the tutorials I had found
mentioned a possible permissions problem, so I hadn't even considered
it. You saved the day.

Now I just have to figure out SQL...

Thanks!!

Chad

Nov 24 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
35671
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the fields. Can this be done in an Access db? I am trying to learn how to do these things in Access vs Visual Dim strIIF As String Dim sstrIIF As String Dim strNewDate As Date
5
7247
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to pull payment data from my database for accounting. It has 3 tables with one-to-many joins: Table1 --> one-to-many --> Table2 --> one-to-many --> Table3 The payment amount field is in Table3. I entered a few negative
4
2489
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field to record the record's status. Sample data: *tblTest* Model Parts CDate CStatus RDate RStatus 616 $359.79 03-Nov-03 C
4
5579
by: Ecohouse | last post by:
I need to be able to access an Outlook folder and read each email and pull data from the email into tables in Access and move the email to another folder. I now about automation but am not sure exactly how to do it for Outlook. Below is an example of an email that I need to pull the data from: DATE/TIME: 8/25/2005 1:57:15 PM
0
2145
by: Kumar | last post by:
Hi Folks, I would like to develop one custom application using asp.net,C#,SQL server for tracking all our company servers. Most of the functionality is similar to HP Systems Insight Manager (http://h18013.www1.hp.com/products/servers/management/hpsim/) I would like to store as much information as we can about server.
5
2027
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
1
1274
by: TheDataGuy | last post by:
Using MS ACCESS 2002 Problem - I developed a form, and within that FORM, I added a SEARCH BUTTON, and then I created a SUB-FORM, so when an end user clicks on the FORM it will POP-UP the SUB-FORM, and in that SUB-FORM I added all the FIELDS I want to view. However, when I try to type in data into the FIELDS I am searching for, it does not let me. I would just like to type in an ID or the name of the Document and have Access PULL that...
5
1686
by: Hollywood | last post by:
Good day dear members of the comp.databases.ms-access newsgroup. Please I need your help on the following. I'm the administrator of an Access 2007 database. I would like my enterprise personnel could add entries to one specific table by the use of an interface or form without launching the data base (because the data is confidential). We do not have Windows Share Point. Please how can I do so ?
5
3997
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make Fields Names: countrycode, make
0
1359
by: shwethatj | last post by:
Can anyone please help me..... In Crystal Reports , how to access data using PULL method .. I have got a table in server explorer which has 3 got fields. But i dont know how to access it and generate a report. Actually i have first selected ASP.NET website with c# language , then i added a crystal report using add item in solution explorer . Later i had setup a new data connection in server explorer. The new connection has got a database...
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.