function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
    {
        if (is_string($conn)) {
            require_once('DB.php');
            $dbConn = &DB::connect($conn, true);
            if (DB::isError($dbConn)) {
                return $dbConn;
            }
        } elseif (is_subclass_of($conn, "db_common")) {
            $dbConn = &$conn;
        } else {
            return self::raiseError('Argument 1 of HTML_Select::loadQuery is not a valid type');
        }
        $result = $dbConn->query($sql);
        if (DB::isError($result)) {
            return $result;
        }
        $this->loadDbResult($result, $textCol, $valueCol, $values);
        $result->free();
        if (is_string($conn)) {
            $dbConn->disconnect();
        }
        return true;
    }
function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
    {
        if (is_string($conn)) {
            require_once('DB.php');
            $dbConn = &DB::connect($conn, true);
            if (DB::isError($dbConn)) {
                return $dbConn;
            }
        } elseif (is_subclass_of($conn, "db_common")) {
            $dbConn = &$conn;
        } else {
            return self::raiseError('Argument 1 of HTML_Select::loadQuery is not a valid type');
        }
        $result = $dbConn->query($sql);
        if (DB::isError($result)) {
            return $result;
        }
        $this->loadDbResult($result, $textCol, $valueCol, $values);
        $result->free();
        if (is_string($conn)) {
            $dbConn->disconnect();
        }
        return true;
    }
function loadQuery ( & $ conn , $ sql , $ textCol = null , $ valueCol = null , $ values = null ) { if ( is_string ( $ conn ) ) { require_once ( 'DB.php' ) ; $ dbConn = & DB :: connect ( $ conn , true ) ; if ( DB :: isError ( $ dbConn ) ) { return $ dbConn ; } } elseif ( is_subclass_of ( $ conn , "db_common" ) ) { $ dbConn = & $ conn ; } else { return self :: raiseError ( 'Argument 1 of HTML_Select::loadQuery is not a valid type' ) ; } $ result = $ dbConn -> query ( $ sql ) ; if ( DB :: isError ( $ result ) ) { return $ result ; } $ this -> loadDbResult ( $ result , $ textCol , $ valueCol , $ values ) ; $ result -> free ( ) ; if ( is_string ( $ conn ) ) { $ dbConn -> disconnect ( ) ; } return true ; }
Queries a database and loads the options from the results

@param     mixed     $conn       Either an existing DB connection or a valid dsn
@param     string    $sql        SQL query string
@param     string    $textCol    (optional) Name of column to display as the OPTION text
@param     string    $valueCol   (optional) Name of column to use as the OPTION value
@param     mixed     $values     (optional) Array or comma delimited string of selected values
@since     1.1
@access    public
@return    void
@throws    PEAR_Error
Queries a database and loads the options from the results