> From: Kondwani Spike Mkandawire [mailto:[EMAIL PROTECTED]] 
> Subject: [PHP] Working under Apache 1.3 but not Under IIS
>
> The function shown below only functions with my
> Apache on WinNT...  I have tried it on my local
> Server (thats the one running the Apache and
> it works perfectly)...  I am trying to step through
> a moderately large database (4MB)...  However when
> I tried the example on the Server for my Work
> Place it returned an error stating that the Script
> took longer than 30 seconds to execute hence
> failed...  When I search for a name at the top of
> the Database it immeadiately Spits out Found!...
> The server on which this fails is an IIS WebServer, I am
> not quite sure what version it is...  I am kind of
> at a loss whether its to do with the scripts efficiency
> or the Servers Settings...  Why is it possible to
> execute the Script easily on my local host...
> 
> Here is the location...
> http://www.coop.mun.ca/verification.php

>if (function_exists(odbc_fetch_array))
>  return;

> function odbc_fetch_array($result, $rownumber=-1) {
>  if (PHP_VERSION > "4.1") {
>    if ($rownumber < 0) {
>      odbc_fetch_into($result, &$rs);
>    } else {
>      odbc_fetch_into($result, &$rs, $rownumber);
>    }
>  } else {
>    odbc_fetch_into($result, $rownumber, &$rs);
>  }
>  foreach ($rs as $key => $value) {
>    $rs_assoc[odbc_field_name($result, $key+1)] = $value;
>  }
>  return $rs_assoc;
>}

Try taking the pass by reference & off of the result set. The man page for 
odbc_fetch_into states: As of PHP 4.0.5 the result_array does not need to be passed by 
reference any longer. 

I've used the code below on 4.1 and 4.2.  If that doesn't work, you might say what php 
version is on each machine, and what line 82 is.

// -------------------------------------------------------------------
// THIS HAS TO BE AT THE END OF THE FILE 
// DON'T ADD ANY OTHER CODE AFTER THIS BECAUSE IT MAY NOT BE EXECUTED
// -------------------------------------------------------------------
if (function_exists('odbc_fetch_array'))
  return;

function odbc_fetch_array($result, $rownumber=-1) {
        $rs_assoc = array();
  if (PHP_VERSION > "4.1") {
    if ($rownumber < 0) {
      odbc_fetch_into($result, $rs);
    } else {
      odbc_fetch_into($result, $rs, $rownumber);
    }
  } else {
    odbc_fetch_into($result, $rownumber, $rs);
  }
  foreach ($rs as $key => $value) {
    $rs_assoc[odbc_field_name($result, $key+1)] = $value;
  }
  return $rs_assoc;
}
// DON'T ADD ANY CODE HERE -- IT MIGHT NOT GET EXECUTED
// ----------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to