PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #641

Only one field for option text from loadQuery

Details

Submitted2004-01-29 10:54 UTC
FromSSantos at web dot de
StatusBogus
PackageHTML_QuickForm
PHP Version4.2.2
OSLinux
Roadmaps(Not assigned)

Comments

[2004-01-29 10:54 UTC] SSantos at web dot de

Description:
------------
When loading options from a database, only one field may
be displayed as option text. I wish to display more than
one database field concatenated together per option
without the need to prepare an array to use for the option
list.

Reproduce code:
---------------
require_once 'DB.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/select.php';
...
$sel = new HTML_QuickForm_Select('select', 'equipType', 'Equipment type');
$sel->loadQuery ($db, 'Select Manufacturer, Type from HWType', 'Type', 'ID');
//$optionTxt should allow >1 DB fields, e.g. instead of 'Type': ARRAY('Manufacturer, 'Type'), $concat=" "
if (DB::isError($sel)) {
echo ($sel->getMessage);
}
$form->addElement($sel);

Expected result:
----------------
"Toshiba Tecra 9100"

Actual result:
--------------
"Tecra 9100"

[2004-01-29 11:17 UTC] mansion at php dot net

This is not supported. You can use the CONCAT() function of your RDBMS if it supports it, and an alias.