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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to