Stored procedures returns no data with PHP 4.0.3pl1 and openlink odbc
| From: | Fredrik dot Palm at notes dot sema dot se | Date: | Thu, 21 Dec 2000 07:54:19 +0000 |
| Subject: | Stored procedures returns no data with PHP 4.0.3pl1 and openlink odbc | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5380@lists.php.net to get a copy of this message | ||
Hi everyone!
I'm using a fresh install of RH7.0, Apache 1.3.14, PHP 4.0.3pl1 and latest
version of Openlink odbc to connect a MS-SQL 7 server.
There is a problem with running stored procedures, they return no data.
I've tested the connection with openlinks odbctest to verify that the data
gets transfered to the Linux server at all, and it does work fine and
returns all the data I'm looking for.
When running a small .PHP-page (source below), I receive no data in the
$result at all (except for num_fields).
[source]
<? include('putenv.inc') ?>
<?
// $sql="SELECT * FROM Navigation where sArea = 'www'";
$sql="exec LnxNavigationTreeQry";
// directly execute mode
if
($conn_id=odbc_connect("$odbcdsn","$odbcuser","$odbcpassword")){
if($result=odbc_do($conn_id, $sql)) {
print(odbc_num_fields($result));
print(odbc_num_rows($result));
print(odbc_result($result,"sDescription"));
// odbc_result_all($result);
odbc_free_result($result);
}else{
echo "Unable to execute sql-statement";
}
odbc_close($conn_id);
}else{
echo "Unable to find to database. Please contact system
administrator.";
}
?>
[end php source]
[SP source]
CREATE Procedure LnxNavigationTreeQry
AS
BEGIN
SELECT *
FROM Navigation
WHERE sArea = "www"
RETURN(0)
END
[End SP source]
If i uncomment that static SQL-string everything works fine, but as the
source looks above, nothing gets returned, except for odbc_num_fields,
which returns an integer of 10, which is valid.
Does anyone have a clue on what's going on here ??
Regards - Fredrik Palm