php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6322 MSSQL function do not work in classes
Submitted: 2000-08-23 19:42 UTC Modified: 2000-11-30 21:41 UTC
From: shazlista at usa dot net Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.0.1pl2 OS: windowsNT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shazlista at usa dot net
New email:
PHP Version: OS:

 

 [2000-08-23 19:42 UTC] shazlista at usa dot 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;
		}
	};

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-30 21:41 UTC] fmk@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC