hi all,
i have a problem with PHP connecting to a remote Access database via ODBC.
Before you get the chance of answering : MySQL is NOT an option this is a program made in access and used by some people here at work so I can’t use MySQL for this.
Problem : We have a program in an Access database that is located on one of our servers here at work. I was asked to create some reporting on our intranet via PHP from that access database. When I try to connect to the db and retrieve data from it, i get a blank screen in both FF and IE. Both servers, webserver and server where the database resides on, are Windows 2003 server in a domain.
Here’s what I did :
- on the webserver I created a SystemDSN to the database via a network-mapping
- programmed this PHP code to test the connection and retrieve some standard data :
<?php$cnx = odbc_connect( 'lecono' , '', '' ); if (!$cnx) { Error_handler( "Error in odbc_connect" , $cnx ); } else { echo "OK!<p>"; } // send a simple odbc query . returns an odbc cursor $cur= odbc_exec( $cnx, "select VLEEFGROMS from Leefgroepen" ); if (!$cur) { Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); } else { echo "Connectie geslaagd!<p>"; // echo "<table border=1><tr><th>Testveld</th></tr>n"; $nbrow=0; //Local variable to count number of rows // fetch the succesive result rows while( odbc_fetch_row( $cur ) ) { $nbrow++; $Testveld= odbc_result( $cur, 1 ); // get the field "VLEEFGROMS" // echo "<tr><td>$Testveld</td></tr>n"; echo "$Testveld<br>"; } }
// echo "
"; $nbrow entries // close the connection. important if persistent connection are "On" odbc_close( $cnx);
?>
If I execute this page however, it returns a blank window in FF & IE. The code works perfectly though because if I put a copy of that database on the webserver and I adjust the SystemDSN, data is returned as it should.
So I suppose this is a security-related problem on the Windows 2003 level.
Any ideas and tips are more than welcome!
Thanks in advance!