$this->db->fetchAll("SELECT * FROM TABLE");
is actually fairly easy to accomplish.
I'm going to assume that you have already set up a database adapter in your application.ini or your bootstrap.php it really doesn't matter which, as long as you have defined an adapter somewhere.
//simplified for demonstration
class SomeController extends Zend_Controller_Action
protected $db;
//items that are put into init() or predispatch() or similar function
//can usually be put into a frontcontroller plugin if needed app wide.
public function init() {
//this works as long as you have only one adapter defined or have set one as default.
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function indexAction() {
//with your db adapter defined you have access to the api for Zend_Db_Table_Abstract
$result = $this->db->fetchRow($sql);
//while a simple string will work as $sql I would
//recommend the select() be used if for not other reason then that
//the queries are built programatically
$select = $this->db->select();
$select->where('id = ?', $id)->orWhere('role = ?', 1); //selects can be chained or separated
$select->order('id','ASC');
$rows = $this->db->fetchAll($select);//returns rowset object, toArray() if needed.
}
}
I think the biggest problem most people have when first using Zend_Db is figuring out which is the best way to use it. There are many ways to use this component and most of us find one we like and use it for everything.
For example a simple sql query can be represented as a string $sql = "SELECT * FROM TABLE";
as a select() object as in my example code.
You can use Zend_Db_Expr to represent more complex expressions $select->where(new Zend_Db_Expr("FIND_IN_SET('$genre', genre)"));
and don't forget Zend_Db_Statement (which I have never used, so can't demo correctly).
Quoting of values and identifiers is available if needed.
[EDIT]
As it has been previously stated you must define a database adpater. I prefer to do this in my application.ini, however the Bootstrap.php is also a common place to define an adapter.
In you application.ini make sure you have at least these lines:
resources.db.adapter = "pdo_Mysql" //or your chosen adapter
resources.db.params.username = "username"
resources.db.params.password = "password"
resources.db.params.dbname = "dbname"
I hope this at least gives you direction to look in. Good Luck!