in the following example, i will assign some variables that belong to a class. But are assigned inside one of the function/methods. If you only assign it as $example and not as $this->example, it does not assign that variable to the entire class, only in that method/function.
class myClass
{
var $example;
var $example2;
function say_what()
{
$example = 'Hi';
$this->example2 = 'Hi again';
echo '$example: '.$example."<br/>";
echo '$example2: '.$example2."<br/>";
echo '$this->example: '.$this->example."<br/>";
echo '$this->example2: '.$this->example2."<br/>";
}
function say_again()
{
echo '$example: '.$example."<br/>";
echo '$example2: '.$example2."<br/>";
echo '$this->example: '.$this->example."<br/>";
echo '$this->example2: '.$this->example2."<br/>";
}
}
$convo = new myClass();
$convo->say_what();
$convo->say_again();
// this is $convo->say_what();
$example: Hi
$example2: //blank
$this->example: //blank
$this->example2: Hi again
// this is $convo->say_again();
$example: //blank
$example2: //blank
$this->example: //blank
$this->example2: Hi again // only this one assigned to class shows.
It would be very helpful it you could add the database layouts.
Also, you only reference one database but you state we need to pull information from two.
In your class you state:
var $cat_id;
var $depth;
var $cat_title;
var $cat_parent_id;
var $cat_long_title;
It is hard to know which tables these belong to.
Also, in your $db->fetchrow(), is this a mysql_fetch_row, or mysql_fetch_object, assoc? Assuming you said row, im guessing it would be a fetch row, but clarification would be nice. Also, maybe a working script.