> 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php