From: [EMAIL PROTECTED] Operating system: W2K PHP version: 4.2.1 PHP Bug Type: MSSQL related Bug description: can't pass result sets between functions
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 bug report at http://bugs.php.net/?id=17302&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17302&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17302&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17302&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17302&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17302&r=support Expected behavior: http://bugs.php.net/fix.php?id=17302&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17302&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17302&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17302&r=globals