I cannot get multiple-constructor code working! Argh.
class GuestBook extends IndieBase
{
// Variables
var $id; // MYSQL ID number from addEntry() or lookupEntry()
var $artist_id;
var $body;
var $email;
var $ip;
var $creation;
var $db;
var $display;
// Constructor
function GuestBook()
{
global $db, $display;
$this->db = $db; // Set our DB pointer
$this->IndieBase(); // Parent Constructor
$this->display = $display; // Set our output pointer.
$arg_list =func_get_args();
$num = count($arg_list);
$name="GuestBook".$num; // Generates something like 'GuestBook1'
switch($num_args)
{
case 0:
//clear vars at least
$this->id = 0;
$this->artist_id = 0;
$this->body = "";
$this->email = "";
break;
case 3:
$this->$name($arg_list[0],$arg_list[1], $arg_list[2]);
break;
default:
echo "Wrong number of parameters on ".get_class($this)." constructor!";
} // end switch
} // end Guestbook()
function GuestBook3($artist_id, $body, $email)
{
$this->artist_id = $artist_id;
$this->body = prepDBText($body);
$this->email = $email;
}
}
When I issue this:
$guestbook = new GuestBook("15","testguestbookentry","fandelem@hotmail.com");
It doesn't work. Period. No error though...
any ideas?
cheers,
k.