php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17601 Stored Procedure Fetch Array
Submitted: 2002-06-04 17:37 UTC Modified: 2002-06-24 19:01 UTC
From: dwhitaker at dgsystems dot com Assigned:
Status: Not a bug Package: Sybase-ct (ctlib) related
PHP Version: 4.1.2 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dwhitaker at dgsystems dot com
New email:
PHP Version: OS:

 

 [2002-06-04 17:37 UTC] dwhitaker at dgsystems dot com
PHP 4.1.2
Solaris
Sybase

We are not able to return more than one row when doing a sybase_fetch_array on a stored procedure.

Here is an example of my code:

$query = sybase_query("EXEC ops_select_mfr @mf_id=$mf_idx",$db);
    while ($row = sybase_fetch_array($query)) {
		$mf_id = $row['mf_id'];
                $display .= "<tr><td>$mf_id</td></tr>";
		}

This is echoed in a table, of course.

The first row is returned but nothing else.
We have checked our data using SQL Advantage so there are multiple rows.

Does sybase_fetch_array work correctly?  If so what are we doing wrong?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-23 22:11 UTC] james dot downie at visy dot com dot au
Try using sybase_fetch_row, but have to refer to the fields by numeric cell references.
 [2002-06-24 17:15 UTC] dwhitaker at dgsystems dot com
We figured this out...

Basically the $db was already called earlier in the code... So here's how to make the code work right...

$connection = @sybase_connect("server_name", "user", "pass") 
	or die("Couldn't connect to the server");

$db = @sybase_select_db("db_name", $connection) 
	or die("Couldn't select database.");

// here's the change take out the $db so it look like

$query = sybase_query("EXEC ops_select_mfr @mf_id=$mf_idx");

In Sybase once you connect to the database you can keep on truckin with out calling it again... not sure that it was meant to be this way, but it works...
 [2002-06-24 19:01 UTC] sniper@php.net
It works as expected:

http://www.php.net/manual/en/function.sybase-select-db.php

This function only 'binds' the connection to a database. So you should be using the $connection variable instead as 
it holds the actual link resource.

--Jani


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 00:01:27 2019 UTC