php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13735 exec sybase procedure in .php but only ' 0 'returns!
Submitted: 2001-10-18 09:47 UTC Modified: 2002-10-28 10:49 UTC
From: wenk at bt-t dot com Assigned:
Status: Not a bug Package: Sybase-ct (ctlib) related
PHP Version: 4.2.1 OS: soliars,win2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wenk at bt-t dot com
New email:
PHP Version: OS:

 

 [2001-10-18 09:47 UTC] wenk at bt-t dot com
I defined the sybase procedure as following:
*******************************************************
create proc circul.circul_hold
	@rec_ctrl_id 		char(10),
	@reader_barcode 	char(14),
	@department_id  	char(2),
	@user_id		char(4),
	@list_no 		int		 output,
	@errmsg		        varchar(200) 	 output
as
......
***********************************************************
and I ececuted this proc in test.php as fllowing:
<?php
include "../include/connect.php";
....
$rec_ctrl_id='15400';
$barcode='21113000694135';
$departid='70';
$userid = 'web';    
$sql = "declare @list_no2 int, @errmsg2 varchar(200) ";
$sql.= "exec circul.circul_hold
'$rec_ctrl_id','$barcode','$departid','$userid',@list_no
=@list_no2 output,@errmsg=@errmsg2 output ";
$sql.= "select list_no = @list_no2 , errmsg = @errmsg2";
$query=sybase_query($sql);
if ($query){
    $array = sybase_fetch_array($query);
    echo $array[list_no] .'<br>';	
    echo $array[errmsg] .'<br>';	
}
...
?>
 I found that $array[list_no]=$array[list_no]=null,and 
 sybase_num_rows($query)=1 and $array[0]= 0,which means
only '0' returns (while the sybase proc excute succeed,it always return 0).
But I execute $sql in SYBASE SQL ADVANTAGE ,I can get 
$array[list_no] and $array[errmsg] ,whilch are not null.

Why?I have been confused for months.
Please tell me the right way to execute sybase proc with output parameters in php as soon as possible.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-24 04:38 UTC] rob_norman at hotmail dot com
I've had a similar experience - the 0 returned is a failure notice, I believe.  I got this error message when trying to connect ('db_name' is the name of the connection I use in the interfaces and hosts files):

Notice: Connection failed to db_name,14224: Connection refused (errflg=2) in Unknown on line 0

I'm using PHP 4.2.1 with Apache 1.3.24, and have Sybase ase-11.0.3.3-6 and ocsd-10.0.4-6 installed. (Do I need *both* of these?)

Never had this problem with an earlier combination of PHP 4.0.4pl1 and Apache 1.3.19 using the same ct lib files.

I still haven't solved this one, so any help would be appreciated!
 [2002-05-24 04:41 UTC] rob_norman at hotmail dot com
Forgot to mention - original config was with RedHat 7.0 - newer (failed) config is with RedHat 7.1
 [2002-08-13 22:56 UTC] kalowsky@php.net
Updating version number
 [2002-10-28 10:49 UTC] sterling@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC