Simple Display Results from Database

For programming and general questions on Zend Framework

Simple Display Results from Database

Postby pana4219 on Wed Nov 06, 2013 1:14 am

I have set up correctly the parameters for Zend_Db::factory and then I am querying like:

$select = $db->select()
->from('imdb')
->limit(10);

$stmt = $db->query($select);
$result = $stmt->fetchAll();

Question:
Why I do not see anything displayed?

I continue and I am trying to display results by creating a new object

$moviesTBL = new Application_Model_DbTable_Imdb();
$this->view->albums = $moviesTBL->fetchAll();

If I combine it with a view it works fine BUT fetches all rows!!! How to make it fetch only first 10?
foreach($this->albums as $key=> $value)
{
echo $value ->rank.' '.$value->rating.' '.$value->title.' '.$value->year.' '.$value->number_of_votes.'<br>';
}
pana4219
 
Posts: 2
Joined: Mon Nov 04, 2013 6:45 pm

Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 4 guests