01-16-2009, 09:29 AM
|
#37 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Name2Id:
Looks currently like this
PHP Code:
private function Name2Id()
{
if ( isset($this->sSettingname) )
{
$this->sSettingname = $this->dbobj->secure($this->sSettingname);
$name2id = $this->dbobj->exeQuery("SELECT option_id, option_name FROM `$this->table` WHERE option_name = '$this->sSettingname'");
if ( $name2id->rows() > 0 )
{
$name2id->getFetch(false, true);
return $name2id["option_id"];
}
} //else trigger_error( self::ERR_SETTINGS_NAME_EMPTY, E_USER_ERROR );
return false;
}
- Same here about the assigning of $name2id like on the $options. You're assigning the dbobject to the $name2id, which is okey, but why?
- Rows function is called getRows as said before
Something like this would be more accurate:
PHP Code:
private function Name2Id()
{
if ( isset($this->sSettingname) )
{
$this->sSettingname = $this->dbobj->secure($this->sSettingname);
$sql = "SELECT option_id, option_name FROM `$this->table` WHERE option_name = '$this->sSettingname'";
if ( $this->dbobj->getRows($sql) > 0 )
{
$array = $this->dbobj->getFetch(false, true);
return $array['option_id'];
}
} //else trigger_error( self::ERR_SETTINGS_NAME_EMPTY, E_USER_ERROR );
return false;
}
But as said before, haven't tested so I don't know if this would work. It should however be more accurate with the SQL class.
__________________
|
|
|
|