需要帮助将数据从 mysql 填充到 bonfire 中的选择框中。
我有两张桌子,货币和薪水。货币表与薪水表相关(作为外键)。所以我试图在工资表中加载货币符号,但不知何故,代码在 mac 上工作,但在 linux 机器上不工作。
文件:bonfire/modules/salary/views/content/create.php
<?php
$options = array();
$query = $this->db->query("SELECT currency_symbol FROM currency");
foreach ($query->result_array() as $row) {
foreach ($row as $key) {
$options[] = $key;
}
}
?>
<?php echo form_dropdown('salary_currency', $options, set_value('salary_currency', isset($salary['salary_currency']) ? $salary['salary_currency'] : ''), 'Currency')?>
这是html的td中index.php的代码:
文件路径:bonfire/modules/salary/views/content/index.php
<?php
$query = $this->db->query("SELECT currency_symbol FROM currency");
$query_result = $query->result_array();
foreach ($query_result as $query_currency_id => $query_currency_symbol ) {
if($query_currency_id == (integer)($record->salary_currency)){
foreach ($query_currency_symbol as $salary_currency_id) {
echo($salary_currency_id);
}
}
}
?>
任何帮助表示赞赏...