Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Connecting To MS Access Database From PHP On Linux


Does anyone know if its possible to connect to an MS Access database, via PHP on a Linux O/S.

I had mistakenly assumed that I could achieve this with the ADODB database abstraction layer, since it lists Access as a supported database.  However, I now understand that this is limited to PHP running on a Windows Server, due to some library/libraries required.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Connecting MSSQL SERVER From SYBASE At LINUX
I have installed sybase ase on Linux and it is working fine. I have a database on sybase ans I am using PHP3 for accessing the database from the browser.

Now I would like to connect the MS-SQLSERVER which is on a NT server in the same network. How to set up the interface file to run both the databases.

Connecting To Access Db
i was working with asp but the site is launched in linux server.had to switch to php.
i had a access db admin.mdb i need to connect to admin.mdb and insert and retrieve data from it.

Connecting To An Access Data Base
i want to connect to a Access data base but dont know how to do it. also how would u add more rows if needed and how would u write to the cells in the tables.

Connecting To A MS Access DB On Remote Server
Does anyone know how I would go about connecting to a remote Access DB via PHP? PHP box is Unix, Access box is NT....do I just use the ODBC functions?

Opening MS Access Db On Linux Using PHP ...
I’m running PHP3 on Linux. I have a MS Access database. Can I open this database on Linux using PHP?

Using An Access Db From Php On Linux? Odbc?
I have my site running on a linux server, and I want to pull data from an access db on a windows server. I have ODBC set up under linux, and can connect to the mssql server that way, is there a free linux odbc driver for access?

Connecting To SQL Database
I have been asked to create an e-commerce website, where we need to
connect to an SQL database. The database is used to run their POS in
several branches. As this database is on the company server and we are
hosting the website with a webhost we have to solve an communication
issue.

Here are the options that I can see:

a. create a branch like environment on the webserver and then directly
access the branch database (OBDC??)

b. run a script that sucks data from the SQL environment and then ftps
it as a text file to a LAMP server. PHP and Mysql (my preferred
platform), will then notice the new file and do something with it?

c. have a direct OBDC connection between the website and the company's
server

What option do you recommend? What difficulties do you see?

I would love to get some ideas from you and more ideas on the typical
problems.

Connecting To A Mssql Database
I tried to connect to a MSSQL database and I was told I had an invalid function call, function not defined. Is there an add-on that needs to be installed for MSSQL to work properly?

$dbconn = mssql_connect("localhost:,"user","password");

Connecting To A Database On A Different Domain ...
I have several sites that need to use a single database. Each site is
on a domain of its on with the database on a separate domain. I
usually use :

-----
$connection = mysql_connect("localhost","username","password") or
die("Couldn't make a connection.");

$db = mysql_select_db("database", $connection)
or die("Couldn't select database.");
-----

...but since the database is not on the "localhost", how do I form the
php code to link to an external database?

I have set the external sites as "Access Hosts" on the main site. What
do I do to connect these external sites to the main database?

Connecting To A Mssql Database
Im having major problems trying to connect to a mssql database thats
hosted on our server.

I've got the ip, username, password and database name, yet no matter
what i try, I cant seem to connect. I've trawled the net for hours
looking for code, has anyone got any that definately works, or just a
simple way I can check the connection.

No Access : Fedora Linux Page Displaid
Ever had a big problem with webpage displaid? We are runing Apache version is Apache/2.0.50 (Fedora) for pc-linux- gnu on i686 mysqladmin Ver 8.23 Distrib 3.23.58, And webpages do not display correctly (very long time).

Security Of Database Connecting Scripts
Is it insecure to have all pages of a site require a common.php page that has the sole purpose of connecting to the database??

If someone found the location of this could they not require it on there webpage and manipulate my database?

Connecting Two Database Populated Select Menus
I am able to grab the data from the database to populate the menus individually using.
PHP Code:

Access Database And Php :(
I have a problem. I've found a web hosting place, and in the site
have created a microsoft access database. But for the life of me I
can not find out how to connect and input data using php! There seems
to be not tutorials on the internet :(

Basically I have a response form, people fill it in and hit submit
then the data is stored in the database.

I'm thinking using php, would it be easier to use another language,
e.g. asp?

SQL Database Access
I have designed the site is by having the index.php being the page that is always getting rendered, and all other php files are called from the index.php. Many of the php files that get included need acsess to the SQL database.

Would it be better to ....

1. open access to the SQL database at the beginning of the index.php file, and then close it again at the end of the index.php file. This would give all my php scripts access to the database without having to establish a connection to the database over and over again. or

2. Open access to the sql database only when i need information from it and then close it again right afterwards. This would cause me to open  and close access to the database multiple times during page rendering.

I am interested in page rendering speed, which option is faster? I am guessing that option 1 woud be faster. I am interested in security, which option keeps the SQL data more secure? I am guessing option 2 would be more secure.

Using Php To Connect To Access Database
First of all I'd like to appologise if this has been posted before, I did try the search, but for some reason instead of result, all I got is a blank screen (did try waiting to see if it was still searching/loading).

I've done some basic php a while ago, but have now been asked to create a php script to query an msaccess database that is running on a WinNT server running IIS.

I've looked around on the internet and have found code similar to the code below. My connection is the name of a system or file ODBC data source. However much I play around with this (such as putting the database path in where "myconnection" is) but I can't seem to get it to connect to the database I get the "Unable to open database" on my page.

<?

$db = 'myconnection'

$conn = new COM('ADODB.Connection');

$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or die ("Unable to access database");

Can PHP Connect/use An Access Database?
I was trying to connect to an Access database (something.mdb or something), but I realise I was using the all familiar MySQL way of doing it, so naturally it didn't work..

If PHP can use this mdb files that Access uses, can anyone tell me how I can utilize them.

Accessing A MS Access Database Thru PHP
I want to know how to establish an ODBC connection thru PHP to a MS Access Database.


For example : to connect to a mySQL we say :

mysql_connect("localhost","username","password");
mysql_select_db("db_name");

Similarly how do we establish an ODBC connection to a DSN ?

I also would like to know if there are any other differences while making of use of MS Access Database instead of a mySQL database.

MS-Access Database Connections Using Php
can anyone help me how to set up a MS access database using php...

Remote Database Access
mySQL server is on a win2000 box and php is on the a linux box and i need to access the mySQL database on the win2000 box, is it possible? how?

PHP With MS Access Database Problem
I am new to PHP, previously I have always programed in ASP. My syntax is suffering slightly with my PHP and I was wondering if someone could please help.

I am running a MS Access database with my PHP pages for the moment until I can figure out MySQL.

I seem to be able to use SELECT from my SQL statements fine, but INSERT or UPDATE is proving a little difficult. Here is my code:

<body>
<p>Your news item has successfully been added</p>
<?php
$date = date('M j, Y');
$title = $_REQUEST['title'];
$newsitem = $_REQUEST['newsitem'];
$sql = "INSERT INTO newsblog (date, title, news) VALUES ('$date', '$title', '$newsitem')";
$conn->Execute($sql);
?>
</body>
</html>
<?php require_once('../includes/close-connection.php');?>

The variables I am passing from my forms pick up perfectly well, I am assuming the problem is something to do with how you execute the SQL statement.

It is giving me this error message:

Fatal error: Call to a member function Execute() on a non-object in ......
ews_add_insert.php on line 18

I know that it is probably just something silly I am missing, please can someone point me in the right direction?

Update Access Database
Can anyone spare a good example of how to update a specific field in a
row within a table in an access database?
I am good with fetching the data and representing in a table, but what
if I want to update a specific field?

MS Access & PHP Database Problem
I'm trying to use a web form that allows users to signup for an email account and then adds their information to a file in which I can import into Microsoft Access to a database I have. Everything imports fine, except on the last field, which is for the password, instead of creating a new record, it just keeps adding to the current record. Here is the code I have been using.

<?php
$line = $first . "$last,$address,$city,$state,$zip,$hphone,$wphone,$uname,$pass";
$fh=fopen('users.txt','a');
fputs($fh, $line);
fclose($fh);?>

Table Name In Ms Access Database
I'd like to know how can i get and store the table names of an ms access database. I use odbc_result_all but i don't know how to exctract and store information about the table name.

Writing To A MS Access Database
I am struggling to write some information to a MS Access database through PHP. I can query the database ok and pull up the first set of information but i can't seem to update the fields after this. I think i may have incorrect syntax near the bottom of the code:

How To Connect PHP And Ms Access Database
how to connect PHP and Ms Access database.

Session Cannot Always Access Database
I have a site where a user logs in and a session variable I created
is used to keep track of the fact that the user is logged in. This
various pages query a MySQL database to get information (mostly to
generate a catalogue and news page). Occasionally when loading a page I
simply get the error "No database selected" when the PHP script attempts
to run the query. Usually I can press reload in my browser (Netscape,
IE, and Opera) and the page will work. Sometimes it won't. What may be
causing this error? The header, if it helps, from most of my PHP scripts
is as follows:

<?php
require_once('Connections/cwab.php');
include ('test-include.php');

session_cache_limiter('nocache');
session_name ("cwautobodyphpsession");
session_start();
?>

Connect To Access Database?
How can i connect to access database and perform all other operations like inserting, selecting andupdating in PHP ?

Database Access From PHP Extension
I am new to developing PHP extensions, but have realized that I need
to move a piece of complex business logic into an extension for
performance reasons. This extension will need to be able to access
Oracle and MySQL databases. Is there someone out there who have done
something similar that can give me some advice on what the best way to...

Access To Different Database Types
I want to implement a php-script where I can access to different
database types as PostSQL, MySQL etc.
Is that possible? Furthermore I want to include an access
authorization which defines the write- or read-access of each user.

Php Trouble With Access Database
I am having real trouble with my php code, it all looks correct and i have had several people look at it and not see anything wrong with it.
I have got a register page where people fill out their details, but when i click submit it seems like it has worked as there was no error messages, but no data actually appears in the database.
Can anyone help me, as i have been getting really annoyed at it as i cant think why it isn't working.

How To Get The Information Arranged From Access Database Using PHP
Now i know how to connect to access database & PHP. But i want to arrange the fields which i am retreiving from the access database... for e.g. I got 2 fields in the access database called name and namedetails. So I want to display name as hyperlink and below that name details . Now i am getting information from the databse but not in that way....how to do that?

Recursion Or Database Access Problem?
I am currently recursing through a directory and reading each text file contained in it, extracting data and inserting it into my database. It never seems to make it all the way through large directories. The directories can contain as much as 200,000 files. It seems to run through a chunk of about 15,000, give or take a few thousand, then just stop. Has this ever occured with anyone else?

How To Access Album Cover Database?
I would like to write (preferably, borrow) some PHP which takes an
album name and looks it up in an on-line database, displays the albums
cover, maybe when clicked on leads to some track listings, lyrics, or
whatever.

Communicate With Access Database Using ODBC?
has anyone has any source / idea that php (under windows environment) could communicate with acess database by using ODBC?

Random Records From Access Database ?
I am retrieving records from an access database in php.But i want to select random 7 records....how can it be done ?

Can't Insert Record Into Access Database
I'm trying to create a registration/login script using Access 2003. I'm using ADOdb to connect through ODBC.

The problem is that I get the little custom error Could Not Connect to Server when I try to insert a record, yet when I use the form with a username I inserted through Access it reads it just fine and returns if the username has been used. Also if I removed line line 23 or die('<b>Could Not Connect to Server</b>'); and it'll complete the script, but it won't insert the record. Code:

Import Data From Access Database To MYSQL
I have some data in access database. I wish to import it (keeping the same structure) in MySQL.

Also I want to know what will be procedure for importing data from databases like Oracle, Sybase, Informix etc.

How Do I Connect To A .mdb (access) Database With A Dsn-less Connection Using Php4?
I need to connect to an Access database without a dsn. Can you give me an example (a simple table display with a while !rs->eof)

Can One Call An Access Database On Computer Using The IP Address?
An old friend of mine recently approached me and said something like:
"I've a computer at my office that has an Access database running on
it. We've most of our company info in there. We'd like to put a portion
of it online as a dynamic site, but we don't want the database to leave
our office. Our office is connected to the Internet through a static
IP. Can you do it?"

I said no, but I also said I'd look into it. Could a PHP script running
on a web server make a call to that database to get info? How does that
work?

Reading Barcode, Updating Access Database
I am writing a tracking system using barcode readers. I have a simple page with two entry points, one to display the form to receive a scanned serial number and the other to do the upload to an Access database. It works okay with a button on the upload screen to return to the form screen but I want to return to the form screen without an OnClick event handler. Basically, I want the user to see the "Enter serial Number" prompt and be able to do scan after scan without having to click on anything else. I need to display the status of the upload after each scan. I have tried using windows.location.href, header(location:etc) , $PHP_SELF etc but without any success.

Can anyone help with syntax to reload or load the page (including entry point and status variables) after the database is updated without the user having to do any clicking? Or is this best handled in Javascript?

ACCESS Database & MySQL And Properties In PHPMyAdmin
I had an Access database and I had always used in my tables (whenever
possible) pop up lists to choose elements.. for example, for a column
I've wrote in "Datensatzherkunft" SELECT tbl.field1 FROM tbl WHERE
tbl.field2 LIKE 'XXX' or I could say that only certain values are
allowed: "X";"O";"S" as an example.
Now I have exported my Access Database to MySql and established from
Access a relation to MySQL so that I can update the database direct
from Access and no from PHPMyAdmin.
The problem is that these information about "where to whole the data
from.." that's to say the "Select tbl.field1...." where not exported
and in PHPMyAdmin I cannot find where I can define such attributes. If
I try to do it from Access I receive I message saying that I cannot
change the properties of the database since it is a linked
(verknüpfte) table. Any idea how can I "export these properties too or
redefine them in PHPMyAdmin?

Inserting A Date Into A Microsoft Access 97 Database
I was wondering if anyone could help me insert a short date into microsoft access 97 using php? i can insert text no problem but i can't seem to be able to insert a date properly. i have been using

//$date = "#" . "$sqlmonth" . "1" . "$cboyear" . "#";

$strSQL = "INSERT INTO tblSupport (tDate) VALUES ($date)";
$result = odbc_exec($connect, $strSQL);

Note: i can insert a date if i hard code it like putting in #01

Error 1044 Access Denied To Database
I am currently working through a book on Dreamweaver and using PHP. I
am having a little trouble with setting up the database though. I
have php 4.2.3 and MySQL 4.0.20a. I am running locally with Apache
1.3.27 on Windows XP Pro.

I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:mysql
ewland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

When I do this however it gives me an error message saying:

Error 1044 Access denied for user: '@localhost' to database
'newland_tours'

and numerous other ones saying:

Error 1046 No Database Selected

If you can help me I'd be very grateful. I think that something must
be wrong or amiss with the settings or the paths to the files in
my.ini file? Or perhaps it is just a bug with php or MySql?

Fixing Multiple Database Access Bug In AdoDB Package
Fixing Multiple Database bug in adoDB

popular data access layer for php, adoDB can support multiple
databases from different provider at time, but not from same provider.
what I mean is if you instantiate two adoDB connection like this

$db1 = &NewAdoConnection ("mysql");
$db1 = &NewAdoConnection ("oracle");

then you can run queries simultaneously from these connections. but if
you want to access two database from same provider like this

$db1 = &NewAdoConnection ("mysql");
$db1 = &NewAdoConnection ("mysql");
$db1->PConnect(logininfo_for_first_database)
$db2->PConnect(logininfo_for_second_database)

then only last action will remain active and if you use
$db1->execute(), it will actually works on second database. if you
want to access any table from first database, it will generate an
error. I think this is an internal bug in adoDB.

How to fix this bug?

if you open adodb-mysql.inc.php and goto function _connect() you will
find this line at the end

1. if ($argDatabasename) return $this->SelectDB($argDatabasename);

now goto SelectDB function and see what it contains actually.

// returns true or false
function SelectDB($dbName)
{
$this->databaseName = $dbName;
if ($this->_connectionID) {
return @mysql_select_db($dbName,$this->_connectionID);
}
else return false;
}

so it basically returns a boolean value, mysql connection link is
stored in $this->_connectionID variable. Now modify this code like this

1. add this line at the declaration section of adodb-mysql.inc.php

var $__db = array();

2. modify the SelectDB function like this

// returns true or false
function SelectDB($dbName)
{
$this->databaseName = $dbName;
if ($this->_connectionID) {
@mysql_select_db($dbName,$this->_connectionID);
$this->__db[$this->_connectionID] = $dbName;
return $this->_connectionID;
}
else return false;
}

3. Now open the _query function and modify it like this

// returns queryID or false
function _query($sql,$inputarr)
{
//global $ADODB_COUNTRECS;
//if($ADODB_COUNTRECS)
$this->SelectDB($this->__db[$this->_connectionID]);
return mysql_query($sql, $this->_connectionID);
//else return @mysql_unbuffered_query($sql,$this->_connectionID);
// requires PHP >= 4.0.6
}

That's it!!, now your adoDB supports multiple databases from same
provider.

Local Access Database To Shared PHP/MySql Hosting Export
My client has an MS Access database application on her local machine. I have
full access to that in terms of changing the design.

I've got a simple PHP/MySql application on shared hosting, so no direct
access to the db server.

I'd like to give her the facility to export the information in her local
Access application to the shared PHP/MySql site. From one command button (or
similar) in the Access application.

It would be probably be a complete overwrite. That is to say all the
information on the shared site would be overwritten with that from the local
machine.

I'm assuming that I'd have to make an HTTP request to some PHP page which
would then run the SQL to delete all the records, then append all the new
ones.

Is this the right approach? I don't want to spend weeks finding out that
this is fundamentally flawed in some way. The client has an ADSL connection.

Php & Connecting
For example I have an IP : port and on connect (for example using telnet) it shows me some info (like current air temp) and after it closing connection.

How can i insert it on my web page using PHP? And on every visit on this page php connects to this IP, gather this info and shows it on page?

Connecting To Db..
this seems pretty straight-forward.. got this code

$link = mysql_connect('localhost:3306', '<uid>', '<pswd>');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully'
mysql_close($link);

from here..
http://us2.php.net/function.mysql-connect

but can't connect, get this error:

Connect to db:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
MySQL server on 'localhost' (10061) in
C:xamppxampphtdocshomeconn.php on line 19
Could not connect: Can't connect to MySQL server on 'localhost' (10061)

I connect to this same MySQL server from Tomcat w/no problem.. what is
issue here pls...

now on top of pg mentioned above, there this description:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags]]]]] )

what does 'resource' refer to here pls... and where to do specify what
db to connect to... (in java you put db-name in same line where you
make the connection..)
(and don't you need a driver to connect, I use a JDBC driver to
connect w/Java..)

Connecting To An API
I need to use a company's API in order to try and convert video files into flash files and then play them Youtube style. There is a set API to use, but the instructions are incredibly vague, and me being new to APIs in general, I have absolutely no idea where to start to get the results. I can program basic PHP forms and database stuff, but this is all new to me. Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved