I am a little new to PHP, so I apologize if this is alot simpler than what I'm making it out to be.
I am attempting to execute some SQL through an ODBC driver, and I seem to have some difficulty in returning the results.
I know my ODBC driver works (I can run the same query through Crystal Reports just fine using the same ODBC driver), but PHP returns no values. I'm starting with a simple script (see below), which ultimately I'd like to put the results into an array for another function. I was able to get this to work on PHP4, but I cannot seem to get this to work on PHP5. I can see on my application logs that I am connecting, but it doesnt seem like the script is executing the query properly.
I get results for $connect and $query, but I get nothing for $result (which according to the PHP documentation, I should get an ODBC result identifier if the SQL command was executed successfully, or FALSE on error. In my case I get absolutely nothing.
Code: Select all
<?php
$connect = odbc_connect('ARSystem', '<username>', '<password>');
$query = "SELECT Change_#, Status FROM CM_Change_Management WHERE Status = 'Draft'";
$result = odbc_exec($connection, $query);
print $connect;
print $query;
print $result;
?>