How to get Column Name With Zend DB
+1
A:
$metadata = $db->describeTable($tableName);
$columnNames = array_keys($metadata);
http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.list-describe
vartec
2009-04-02 08:29:17
That's not really 100% correct as $metadata is an associative array ('column_name' => array()) of associative arrays (one for each column of the table).
Stefan Gehrig
2009-04-02 08:34:16
+2
A:
This is the correct answer, the older answers are wrong or outdated:
$cols = $table->info(Zend_Db_Table_Abstract::COLS);
corné
2009-09-21 09:20:15
rewrote your intro-text since SO doesn't know 'bumping' and questions/answers are not considered old. in fact SO is a wiki and updating it is one of the best things you can do! +1
tharkun
2009-09-21 09:39:36