|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-12-15 07:05 UTC] p dot reynolds at sheffield dot ac dot uk
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 22:00:02 2025 UTC |
When I try to issue an "odbc_exec()" command to interrogate a MS Access database through ODBC4, PHP.EXE crashes with the following DrWatson message: "Exception: access violation (0x0000005), Address: 0x1f42cf70" This did not happen with PHPv3 - the script worked perfectly. The following script can reproduce the error: <HTML> <HEAD> <TITLE>Test ODBC</TITLE> </HEAD> <BODY> <? //__________________________________________________________ // // test_odbc.php3 // A sample PHP script to test ODBC under PHP / WinNT // Leo West - 08/1998 //__________________________________________________________ function Error_Handler( $msg, $cnx ) { echo "$msg \n"; // in case of persistent connexion, it is important to close it before exiting. odbc_close( $cnx); exit(); } // create an ODBC connection, returned in $cnx $cnx = odbc_connect( 'WebDB' , 'webuser', 'webpassword' ); if( ! $cnx ) { Error_handler( "Error in odbc_connect" , $cnx ); } // send a simple odbc query . returns an odbc cursor //***THIS IS WHERE THE CRASH OCCURS*** $cur= odbc_exec( $cnx, "select id,nom from T_FrenchTown" ); if( ! $cur ) { Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); } echo "<table border=1><tr><th>id</th><th>nom</th></tr>\n"; $nbrow=0; // fetch the succesive result rows while( odbc_fetch_row( $cur ) ) { $nbrow++; // get the field "id" $id= odbc_result( $cur, 1 ); // get the field "nom" $nom= odbc_result( $cur, 2 ); echo "<tr><td>$id</td><td>$nom</td></tr>\n"; } echo "<tr><td colspan=2>$nbrow entries </td></tr></table>"; // close the connection. important if persistent connection are "On" odbc_close( $cnx); ?> </BODY> </HTML> I have not included the php.ini file as I have not changed it from the default version included with the PHP4 distribution. I am currently running Apache 1.3.9 on a Windows NT4S with SP6a installed. I have also installed ODBC version 4.