請任何人建議如何顯示下拉列表中的數據顯示在下拉列表中的數據庫表列表? 選項屬性中將使用哪些代碼?如何使用笨
我的控制器
public function tableReports()
{
$data['tables']=$this->DbReports->selectTable('snehal_pharma');
$this->load->view('reports/rpt.php');
}
型號代碼
function selectTable($db)
{
$query=$this->db->list_tables();
print_r($query);
return $query;
}
查看
<div class="span12">
Table List :
<select name="tbl" style="width: 150px;">
<?php foreach($tables->result() as $tbl){ ?>
<option><?php echo $tbl;?></option>
<?php } ?>
</select>
</div>
輸出
陣列([0] => account_groups [1] => account_undergroup [2] => batch_master [3] => batch_packing [4] => batch_stock [5] => company_master [6 ] => cost_sheet [7] => cost_sheet_details [8] =>顧客[9] =>部門[10] => disp_material [11] => dm_gatepass [12] => equipment_master [13] => es_finance_master [14] = > es_ledger [15] => es_voucher [16] => es_voucherentry [17] => exipient [18] => mail_date [19] => pm_issue [20] =>購買[21] => purchase_details [22] => purchase_indent [23] => purchase_items [24] => purchase_master [25] => PURCHASE_ORDER [26] =>銷售[27] => sales_details [28] => sales_items [29] => sales_master [30] => sop_master [31 ] => stock_register [32] => stockcategory [33] => stockmaster [34] => supplier_master [35] => supply_order [36] => taxcategories [37] => tbl_state [38] => tbluser [39] => unit_pack [40] => unitsofmeasure [41] => view_salesledger [42] => viewbatchstock [43] => www_users [44] => zformulamaster [45] => zpackmaster)
'<選項值= 「」><?PHP的回聲$ TBL;?>' –
JYoThI
不工作我試過 –
你的意思是'不工作'。有沒有錯誤? – JYoThI