You are here: Strange warning when trying to create a class « PHP Programming Language « IT news, forums, messages
Strange warning when trying to create a class

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация