[PHP-DEV] PHP 4.0 Bug #6322 Updated: MSSQL function do not work in classes From: fmk <email protected>
Date: 11/30/00

ID: 6322
Updated by: fmk
Reported By: shazlista <email protected>
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 <email protected>
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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>