PHP 4.0 Bug #6322: MSSQL function do not work in classes
| From: | shazlista at usa dot net | Date: | Wed, 23 Aug 2000 23:42:21 +0000 |
| Subject: | PHP 4.0 Bug #6322: MSSQL function do not work in classes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-30446@lists.php.net to get a copy of this message | ||
From: shazlista@usa.net
Operating system: windowsNT
PHP version: 4.0.1pl2
PHP Bug Type: MSSQL related
Bug description: MSSQL function do not work in classes
i tried to include basic functions for connect, execute queries, fetch rows... in classes.
whenver i execute on of the fetch functions : first time it works fine, the next call to fetchrow
generates gpe.
$GolbalConnection=null;
class connection
{
function connection($Server,$UserName,$Password,$db)
{
global $GolbalConnection;
$GolbalConnection=odbc_connect($Server,$UserName,$Password);
}
function getc()
{
return $GolbalConnection;
}
};
class recordset
{
var $res;
function getr()
{
return $this->$res;
}
function open($q)
{
global $GolbalConnection;
//settype($this->$row,"array");
$this->$res=odbc_exec($GolbalConnection,$q);
if(!$this->$res)
$this->$res=0;
return $this->$res;
}
function fetchrow($r=0)
{
static $row;
if($this->$res!=0)
{
if($r>0)
{
$t=odbc_fetch_row($this->$res,$r);
}
else
{
$t=odbc_fetch_row($this->$res);
}
}
if(!$t)
$row=null;
else
{
$row=null;
for($i=0;$i<odbc_num_fields($this->$res);$i++)
{
$nm=odbc_field_name($this->$res,$i+1);
$row[$nm]=odbc_result($this->$res,$nm);
}
}
return $row;
}
};