PEAR Manual
Prev |  | Next

# HTML_QuickForm_select::loadQuery()

HTML_QuickForm_select::loadQuery() -- Queries a database and loads the options from the results

## Synopsis

    require_once 'HTML/QuickForm/select.php';

``mixed HTML_QuickForm_select::loadQuery` (mixed &$conn, string $sql [, string $textCol = `NULL` [, string $valueCol = `NULL` [, mixed $values = `NULL`]]])`

## Description

If no column names are specified the first two columns of the result are used as the text and value columns respectively.

## Parameter

mixed `&$conn`

  Either an existing DB connection or a valid dsn

string `$sql`

  SQL query string

string `$textCol`

  (optional) Name of column to display as the OPTION text

string `$valueCol`

  (optional) Name of column to use as the OPTION value

mixed `$values`

  (optional) Array or comma delimited string of selected values

## Throws

throws PEAR_Error

## See

see load(), loadDbResult(), addOption().

## Note

since 1.1

This function can not be called statically.

Prev | Home | Next
HTML_QuickForm_select::loadDbResult() | Up | HTML_QuickForm_select::setMultiple()