RE: [PHP] Access DB & PHP
| From: | John W. Holmes | Date: | Mon, 17 Mar 2003 01:31:12 +0000 |
| Subject: | RE: [PHP] Access DB & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139901@lists.php.net to get a copy of this message | ||
> I have a client who insists on using PHP and an Access database. He
> describes a problem with the access databases becoming locked when a
user
> clicks 'stop' in their browser whilst downloading the page (and I have
to
> stop the IIS server to release it). I have absolutely no experience
with
> PHP/Access connections, so I thought I'd ding it along and see if the
> elite
> PHP programmers of the world can pick up an error in his code.
>
> >
> > I connect like this:
> > $conn = new COM ('ADODB.Connection');
> > $conn->Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data
> > Source='c:\\home\\westir\\data\\libcat.mdb'");
> > $sql = "SELECT * FROM tbl_name ";
> > $result = $conn->Execute($sql);
> >
> > // deal with the database generated information
> >
> > $result->Close()
> > $conn->Close
>
> Is there a better way to do this?
Have a look at register_shutdown_function() to ensure that your database
connection is closed, whether the script ends or is stopped or whatever.
www.php.net/register_shutdown_function
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/