#17302 [Opn->Fbk]: can't pass result sets between functions

From: Date: Tue, 03 Dec 2002 19:53:45 +0000
Subject: #17302 [Opn->Fbk]: can't pass result sets between functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26558@lists.php.net to get a copy of this message
ID: 17302 Updated by: fmk@php.net Reported By: sunmiewon@yahoo.com -Status: Open +Status: Feedback Bug Type: MSSQL related Operating System: W2K PHP Version: 4.2.1 New Comment: 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 ? Previous Comments: ------------------------------------------------------------------------ [2002-05-17 23:08:42] sunmiewon@yahoo.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; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17302&edit=1

« previous php.bugs (#26558) next »