|
Posted by laredotornado@zipmail.com on 03/09/06 05:23
Hi,
Using PHP 4, I'm trying to create a class, and I get warnings in my
constructor function like the one below:
Notice: Undefined variable: m_cat_to_buy in
/usr/local/apache/htdocs/myfiles/dc_fns.php on line 72
Here is the code for my class:
class CProductForFree {
var $m_cat_for_free = "";
var $m_sub_cat_for_free = "";
var $m_style_for_free = "";
var $m_color_for_free = "";
var $m_size_for_free = "";
function CProductForFree($p_cat_for_free,
$p_sub_cat_for_free,
$p_style_for_free,
$p_color_for_free,
$p_size_for_free)
{
$this->$m_cat_for_free = $p_cat_for_free;
// line 72
$this->$m_sub_cat_for_free =
$p_sub_cat_for_free;
$this->$m_style_for_free = $p_style_for_free;
$this->$m_color_for_free = $p_color_for_free;
$this->$m_size_for_free = $p_size_for_free;
} // CProductForFree
} // CProductForFree
Why is the warning appearing and what can i do to correct it?
Thanks, - Dave
Navigation:
[Reply to this message]
|