Some minor details about 2 of your functions that I don't think will work with the SQL class. Concerns the graboptions and name2id functions.
graboptions:
Looks like this currently
PHP Code:
private function grabOptions()
{
$options = $this->dbobj->exeQuery("SELECT option_id, option_name, option_value FROM `$this->table`");
if ( $options->rows() > 0 )
{
while ( $options->getFetch(false, true) )
{
$this->configinfo["$options[option_name]"] = $options[option_value];
}
return true;
}
return false;
}
- The $options variable is pretty useless, since the assignment to it comes from the result of exeQuery, which only returns $this, which basicly means that you're assigning $options = $this->db;. You don't need the $option variable there.
- The rows function is called getRows
- The while loop looks a little suspicious, not sure if it would work. If you check the SQL class, you see that when I fetch the array, I already loop it there with a while loop. So you don't need to use a while loop in your code, you can skip it. Use a foreach instead to get the results.
- You should always use ' whenever you're checking a specific value in an array: $options['option_value']
- If you're checking a value inside an array, against a variable, I don't think it's neccessary to use ": $this->configinfo[$options['option_value']]
Something like this would be more accurate I think:
PHP Code:
private function grabOptions()
{
$sql = "SELECT option_id, option_name, option_value FROM `$this->table`";
if ( $this->dbobj->getRows($sql) > 0 )
{
$options = $this->dbobj->getFetch(false, true);
foreach( $options as $option )
{
$this->configinfo[$option['option_name']] = $option['option_value'];
}
return true;
}
return false;
}
But.. haven't tested so I don't know. It should be more correct with the SQL class however.