php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17302 can't pass result sets between functions
Submitted: 2002-05-17 23:08 UTC Modified: 2002-12-19 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sunmiewon at yahoo dot com Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 4.2.1 OS: W2K
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-05-17 23:08 UTC] sunmiewon at yahoo dot com
Using PHP 4.2.1 on Apache in W2K, connecting to MSSQL7 also on W2K. The db connection seems to work fine and I get data returned. The problem is when I try to split the data retrieval in one function, and then pass the result set back to another script. No data gets returned and my script hangs for a while. If I run the retrieval in-line with the display script, things are fine.

//* Does work *//
   $conn = db_connect_user();
   if ($conn==false)
      return false;
   $result = mssql_query("select id, name, db_name
                             from rm_company", $conn);
//Loop through and gather the info about the orders for this customer
        $count  = mssql_num_rows($result);
        for($i = 0; $i < $count; $i++) {
            $company_list[$i][0]=mssql_result($result,$i,0);
            $company_list[$i][1]=mssql_result($result,$i,1);
            $company_list[$i][2]=mssql_result($result,$i,2);
        }
if(!($company_list==false))
{
$list_count = count($company_list);
// etc.
**********************
//*Does not work*//
..top of script..
$company_list = get_company_list();
if(!($company_list==false))
{
$list_count = count($company_list);

..further down script/in another script (have tried both)..

function get_company_db()
{   $conn = db_connect_user();
   if ($conn==false)
      return false;
   $result = mssql_query("select id, name, db_name
                             from rm_company", $conn);
    if (!$result)
      return false;  // not found
    else if (mssql_num_rows($result)==0)
      return false; // no orders found
    else
        {
        //Loop through and gather the info about the orders for this customer
        {
        $count  = mssql_num_rows($result);
        for($i = 0; $i < $count; $i++) {
            $company_list[$i][0]=mssql_result($result,$i,0);
            $company_list[$i][1]=mssql_result($result,$i,1);
            $company_list[$i][2]=mssql_result($result,$i,2);
        }
        }
        return $company_list;
    }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-03 13:53 UTC] fmk@php.net
Two lines from your sample code indicates that you are calling 'get_company_list' but the function is named 'get_company_db'. Could this be the problem ?

 [2002-12-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri May 24 00:01:26 2019 UTC