Re: overload() problem

From: Date: Mon, 22 Dec 2003 23:47:51 +0000
Subject: Re: overload() problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173207@lists.php.net to get a copy of this message
Cliff Wells wrote:
I'm trying to write a class for abstracting some aspects of database programming and am running into a problem: http://hashphp.org/pastebin.php?pid=567
Well, I kept hacking at it and changing the describe() method from this: // get a description of a table function describe($table) {
       $db = $this->db;
             $q = $db->prepare("SELECT * FROM $table LIMIT 0");
       $result = $db->execute($q);
             foreach ($result->tableInfo() as $c)
           $this->columns[$c['name']] = NULL;
} to this: // get a description of a table function describe($table) {
       $db = $this->db;
       $columns = array();
                $q = $db->prepare("SELECT * FROM $table LIMIT 0");
       $result = $db->execute($q);
             foreach ($result->tableInfo() as $c)
           $columns[$c['name']] = NULL;
                 $this->columns = $columns;
} seems to fix it. I can't see any reason why other than what appears to be general PHP brokenness. If anyone has a rational explanation as to why this is so I'd be grateful to hear it. Regards, Cliff

« previous php.general (#173207) next »