Jump to content

OOP class assigning issue


strazdinjsh

Recommended Posts

would anyone know how to assign the value (value returned by some function in the class) of variable $temp in the class: source looks like:

 

class newRecord{
var $temp = listCat('gallery_menu', 'submenu', 'submenu_id'); ////// this line is not working, does not assign?

	function listCat($table, $submenu, $submenu_id)
	{
	$return = '<select name="'.$submenu_id.'" id="'.$submenu_id.'">';
	$result = mysql_query("SELECT * FROM $table");
	while($row=mysql_fetch_object($result))
		{
		$return = $return.'<option value="'.$row->id.'">'.$row->$submenu.'</option>';
		}
		$return = $return.'</select>';
	return $return;
	}


}

 

if function is used out of the class and used in index.php directly, returns expected value of it (there is no doubts - works ok)

Link to comment
https://forums.phpfreaks.com/topic/222375-oop-class-assigning-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.