我有一个包含列id,名称,描述,日期的数据库。我想从我的数据中只选择两列来填充我的zend select表单元素。在zend中有任何方法来获取指定列的所有数据。请帮忙..
由于
答案 0 :(得分:0)
尝试select
$select = new Select();
$select->from('table')//table name
->columns(array('vch_no'))//place your column here
->where()//condition array
->order();//order column name
例如:
$select = $db->select()
->from(array('p' => 'products'),
array('product_id', 'product_name'));
// Build this query:
// SELECT p."product_id", p."product_name"
// FROM "products" AS p
答案 1 :(得分:0)
试试这个
$objDb = Zend_Registry :: get('db');//You need to setup the database configurations ready in the registry before using it
$select = $objDb->select();
$select -> from('tablename',array('column1','column2'));
$select -> where()
-> order();
$rows = $objDb->fetchAll($select);