protected function getLookupTableValues($table, array $selectFields, array $whereParts)
    {
        $dbHandle = $this->getDatabase()->getDatabaseConnection();

        $whereCondition = $whereValues = array();
        foreach ($whereParts as $field => $value) {
            $whereCondition[] = '`' . $field . '` = :' . $field;
            $whereValues[':' . $field] = $value;
        }

        $query = 'SELECT `' . implode('`,`', $selectFields) . '`
                  FROM ' . $table . '
                  WHERE ' . implode(' AND ', $whereCondition) . '
                  LIMIT 1';

        $statement = $dbHandle->prepare($query);
        $executeResult = $statement->execute($whereValues);

        $statement = $this->getDatabase()->checkQueryError($statement, $executeResult, $whereValues);
        return $statement->fetch(\PDO::FETCH_ASSOC);
    }
protected function getLookupTableValues($table, array $selectFields, array $whereParts)
    {
        $dbHandle = $this->getDatabase()->getDatabaseConnection();

        $whereCondition = $whereValues = array();
        foreach ($whereParts as $field => $value) {
            $whereCondition[] = '`' . $field . '` = :' . $field;
            $whereValues[':' . $field] = $value;
        }

        $query = 'SELECT `' . implode('`,`', $selectFields) . '`
                  FROM ' . $table . '
                  WHERE ' . implode(' AND ', $whereCondition) . '
                  LIMIT 1';

        $statement = $dbHandle->prepare($query);
        $executeResult = $statement->execute($whereValues);

        $statement = $this->getDatabase()->checkQueryError($statement, $executeResult, $whereValues);
        return $statement->fetch(\PDO::FETCH_ASSOC);
    }
protected function getLookupTableValues ( $ table , array $ selectFields , array $ whereParts ) { $ dbHandle = $ this -> getDatabase ( ) -> getDatabaseConnection ( ) ; $ whereCondition = $ whereValues = array ( ) ; foreach ( $ whereParts as $ field => $ value ) { $ whereCondition [ ] = '`' . $ field . '` = :' . $ field ; $ whereValues [ ':' . $ field ] = $ value ; } $ query = 'SELECT `' . implode ( '`,`' , $ selectFields ) . '`
                  FROM ' . $ table . '
                  WHERE ' . implode ( ' AND ' , $ whereCondition ) . '
                  LIMIT 1' ; $ statement = $ dbHandle -> prepare ( $ query ) ; $ executeResult = $ statement -> execute ( $ whereValues ) ; $ statement = $ this -> getDatabase ( ) -> checkQueryError ( $ statement , $ executeResult , $ whereValues ) ; return $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ; }
Returns lookup values from a database table

@param string $table Lookup tablename
@param array $selectFields Array of fields to select
@param array $whereParts Where parts which will be concatted with AND
@return mixed
Returns lookup values from a database table