I'm new to the list and have been out of Linux for quite a while so any help
will be appreciated. I couldn't find anything that referenced my issue, so
if this is the wrong forum, I apologize. If you can direct me to the
correct one, I would be most appreciative. I found a similar question
posted before, but no one answered it.
I have a client who needs to access a Microsoft Access DB across the
network, thus MDBTools to the rescue. My test system has Fedora 5, and I
have installed the following:
Unix ODBC 2.2.11
MDBTools 0.5.1
MDBTools ODBC 0.5.1
I created a share to the Windows system and made the DSN entries in the
ODBC.ini file. I am able to access the DB at the command line using
mdb-sql, so I think I have it all set up correctly.
My problem comes when I use PHP. I created a simple page just to test the
connection. But I get nothing, not even an error message. Can anyone help
me?
Thanks,
Steve
The code is as follows (just the PHP, no tags):
$data_source='database';
$user='';
$password='';
# Connect to the data source and get a handle for that connection.
$conn=odbc_connect($data_source,$user,$password);
if (!$conn){
if (phpversion() < '4.0'){
exit("Connection Failed: . $php_errormsg" );
}
else{
exit("Connection Failed:" . odbc_errormsg() );
}
}else{
exit("Connection Failed:' . odbc_errormsg() );
}
# This query generates a result set with one record in it.
$sql="SELECT 1 AS test_col";
# Execute the statement.
$rs=odbc_exec($conn,$sql);
# Fetch and display the result set value.
if (!$rs){
exit("Error in SQL");
}
while (odbc_fetch_row($rs)){
$col1=odbc_result($rs, "test_col");
echo "$col1";
}
# Disconnect the database from the database handle.
odbc_close($conn);
--
View this message in context: http://www.nabble.com/MDBTools-and-PHP-tf1927103.html#a5277529
Sent from the MDB Tools - Dev forum at Nabble.com.
|