note 17257 rejected from keyword.extends by zak
| From: | zak@php.net | Date: | Sun, 02 Dec 2001 04:44:36 +0000 |
| Subject: | note 17257 rejected from keyword.extends by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21521@lists.php.net to get a copy of this message | ||
Extension doesn't work with mysql resources (and maybe other resources).
Why - I have no clue.
Here's a test case:
<?php
class mysql_test
{
var $cs;
function mysql_test()
{
$this->cs=mysql_connect();
mysql_select_db("forum", $this->cs);
}
function getcs()
{
var_dump($this->cs);
print "About to return resource: ".$this->cs;
return $this->cs;
}
function destroy()
{
mysql_close($this->cs);
}
}
class mysqlstats extends mysql_test
{
function mysqlstats()
{
print 'Cs is: '.$this->cs;
}
function mysqlcount($table)
{
$rs=mysql_query("SELECT COUNT(*) AS num FROM $table", $this->cs);
if(!$rs)
{
print mysql_test::getcs();
}
return mysql_result($rs,0,"num");
}
}
$s=new mysqlstats;
print $s->mysqlcount("my_table");
?>