View Single Post
Old 01-16-2009, 09:29 AM   #37 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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() > )
            {
                
$name2id->getFetch(falsetrue);

                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) > )
        {
                
            
$array $this->dbobj->getFetch(falsetrue);

            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.
__________________
Tanax is offline  
Reply With Quote