MDB2 and QuickForm
| From: | Köteles Zoltán | Date: | Mon, 05 Jun 2006 12:11:14 +0000 |
| Subject: | MDB2 and QuickForm | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24248@lists.php.net to get a copy of this message | ||
Hello!
I'm newbie in pear and I have a newbie question.
I'd like to create a select list with QuickForm and the select data comes from a query.
Example:
$mdb2 =& MDB2::connect($dsn, $options);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
$query = "
SELECT c.country_id AS country_id, c.country_name AS country_name
FROM ".$prefix."_books_country AS c
ORDER BY c.country_name
";
$result = $mdb2->queryAll($query);
if (PEAR::isError($result)) {
die($result->getMessage());
}
$form = new HTML_QuickForm('system', 'post', 'admin.php?p=system');
$form->addElement('header', 'system', $str_System_Header_Text);
$form->addElement('hidden', 'act', 'upd');
$form->addElement('text', 'pagename', $str_System_Pagename_Text);
$select =& $form->addElement('select', 'language', $str_System_Language_Text);
$select->loadDbResult($result, 'country_name', 'country_id');
$form->display();
But the select list is empty.
What's wrong with my scripts?
Thanks a lot
ZoTyA
ps: if I do this: var_dump($result), I see the result of the query