|
Posted by Thomas Pundt on 05/13/05 10:49
Hi,
On Friday 13 May 2005 02:17, JM wrote:
| I'm trying to build a select/option list off of a database select.
| I've confirmed that the correct data is coming out of the query. My
| options are empty in the template though. This is my first attempt at
| html_options. I'm doing something wrong, any help? TIA
|
|
| PHP:
|
| // Build job selector pulldown
| $sql_job_pulldown = "SELECT Job FROM t_jobinfo;";
|
| if($result = $mysqli->query($sql_job_pulldown))
| {
| // dump into a select statement
| // fetch associative array
| $smarty->assign('JOB_OPTION', $result);
| $result->close();
| }
$result is the database query handle - not an associative array, right?
In case I use a {html_options} element I fill it using something like
(using DB interface):
while ( $row = $res->fetchRow() ) {
$options[$row->key] = $row->value;
}
$template->assign('JOB_OPTION', $options);
Best regards,
Thomas Pundt
--
Dr. Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----
Navigation:
[Reply to this message]
|