I have Fedora 9, MySQL 5, PHP 5, and the standard ODBC tools installed.
I have configured my odbc.ini file, in /etc/, to hold the details for my database, and others, and am able to connect into the database through either Open Office or ISQL and query the data.
However, using the following PHP script, see below, I get no result at all (in fact I am only presented with the result of the first echo). I have search this but am struggling to find anything to resolve it.
I have to use ODBC as my live website does and so I want to develop in the same environment. Can you help me?
echo "Begining - Setting up connection <br />";
# connect to a DSN "DSN_NAME" with a user "Bob" and password "Marley"
$connect = odbc_connect("test", "test", "test") or die(mysqlerror());
echo "Connection set, now setting query <br />";
# query the users table for all fields
$query = "SELECT * FROM master";
echo "Query set, now executing <br />";
# perform the query
$result = odbc_exec($connect, $query);
echo "Execution complete, now printing results <br />";
# fetch the data from the database
$field1 = odbc_result($result, 1);
$field2 = odbc_result($result, 2);
# close the connection