Home » HTML » HTML_QuickForm » Bug #641
Only one field for option text from loadQuery
Details
| Submitted | 2004-01-29 10:54 UTC |
|---|---|
| From | SSantos at web dot de |
| Status | Bogus |
| Package | HTML_QuickForm |
| PHP Version | 4.2.2 |
| OS | Linux |
| 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.