Big9erFan
12-04-2007, 04:46 PM
Ok, I've been tearing my hair out over this trying to figure out what is going on. I'm at a loss, and probably just missing something REALLY simple, but I'm at a total loss.
I'm writing a little custom vba module for my guild.
I have 3 templates that I pull in
So I do something like this
global $vbulletin;
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_progression_header') . '";');
$instances = $vbulletin->db->query_read( "SQL STUFF HERE" );
while ($instance = $vbulletin->db->fetch_array($instances))
{
$img_name = $instance['image'];
$name = $instance['name'];
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_progression_data') . '";');
}
That works fine.
Now, trying to put it into a class
class cls_progression
{
var $theDB;
function cls_progression( $DB )
{
$this->theDB = $DB;
}
function LoadInstances()
{
$instances = $this->theDB->db->fetch_array( $this->theDB->db->query_read("SQL STUFF HERE" ) );
$iCount = $this->theDB->db->num_rows($instances);
echo "iCount = $iCount";
while ($instance = $this->theDB->db->fetch_array($instances))
{
$img_name = $instance['image'];
$name = $instance['name'];
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_progression_data') . '";');
}
}
//call the class:
$progress = new cls_progression( $vbulletin );
$progress->LoadInstances();
the class doesn't work at all. I know it is called, but the echo returns just
"iCount = "
I'm horribly confused :(
I'm writing a little custom vba module for my guild.
I have 3 templates that I pull in
So I do something like this
global $vbulletin;
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_progression_header') . '";');
$instances = $vbulletin->db->query_read( "SQL STUFF HERE" );
while ($instance = $vbulletin->db->fetch_array($instances))
{
$img_name = $instance['image'];
$name = $instance['name'];
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_progression_data') . '";');
}
That works fine.
Now, trying to put it into a class
class cls_progression
{
var $theDB;
function cls_progression( $DB )
{
$this->theDB = $DB;
}
function LoadInstances()
{
$instances = $this->theDB->db->fetch_array( $this->theDB->db->query_read("SQL STUFF HERE" ) );
$iCount = $this->theDB->db->num_rows($instances);
echo "iCount = $iCount";
while ($instance = $this->theDB->db->fetch_array($instances))
{
$img_name = $instance['image'];
$name = $instance['name'];
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_progression_data') . '";');
}
}
//call the class:
$progress = new cls_progression( $vbulletin );
$progress->LoadInstances();
the class doesn't work at all. I know it is called, but the echo returns just
"iCount = "
I'm horribly confused :(