PHP 4.0 Bug #6322 Updated: MSSQL function do not work in classes

From: Date: Fri, 01 Dec 2000 02:41:03 +0000
Subject: PHP 4.0 Bug #6322 Updated: MSSQL function do not work in classes
Groups: php.dev 
Request: Send a blank email to php-dev+get-39762@lists.php.net to get a copy of this message
ID: 6322 Updated by: fmk Reported By: shazlista@usa.net Status: Closed Bug Type: MSSQL related Assigned To: Comments: This is not related to MSSQL, as you use ODBC functions in your class. Anyway testing this on php4.0.3 causes no problems at all. Previous Comments: --------------------------------------------------------------------------- [2000-08-23 19:42:21] shazlista@usa.net 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; } }; --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6322

« previous php.dev (#39762) next »