ID:               17302
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-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] [EMAIL PROTECTED]

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

Reply via email to