Hi, I'm trying to connect to an Oracle DB from an NT/IIS/PHP server. I'm getting connected but the query isn't returning anything. I get the message that it connected successfully but then it just spins its wheels. Any help appreciated. Here is my test script.
<?PHP
if ($conn_id = odbc_connect("dev", "test", "test")) {
echo("Connection successful!");
$result = odbc_exec($conn_id, "SELECT SYSDATE FROM DUAL");
odbc_fetch_row($result);
$field1 = odbc_result($result, 1);
echo($field1);
odbc_close($conn_id);
} else {
echo("Cannot connect to data source");
}
?>
Help: Can't get results returned from query
Moderator: General Moderators
Perhaps the problem is here.
The reason being that you have no idea if the query ran with success or not. Why not check $result and see what is returned. You could also use odbc_num_rows() to find out how many rows were found.
Cheers,
BDKR
Code: Select all
$result = odbc_exec($conn_id, "SELECT SYSDATE FROM DUAL");Cheers,
BDKR