Zend_Db
Posted: Wed Dec 05, 2007 6:18 am
As you may know, Im getting started with the Zend Framework because of silly bosses. In my framework I have made it simple to execute the most common queries so if I want do do this query:
I would just do this:
which makes $news an array with each element being a stdClass of the model ($this->NEWS) and the variables of the fields being what was queried from the db. It works very well and its super easy.
Now! The Zend Framework way! I can't seam to find what would be the Zend equivilant of my get_list() function. The only thing I see is the fetchAll which I find to be silly because I don't want to fetch them all, just some. Also, I want to specify which rows I will be returning because in table with 30 some rows, all I need is 2.
The zend framework website seams to be down (no suprise) so I can't check there but I remember looking for it before and not being able to find any answers so now I ask you guys who might have some expierence with the framework.
Code: Select all
SELECT
`headline`, `url_headline`, `posted_time`
FROM
table_name
ORDER BY
`id`
DESC
LIMIT 5
//then the whole execute and get data and whatnot...Code: Select all
$news = $this->NEWS->get_list(array('headline', 'url_headline', 'posted_time'), null, null, 'ORDER BY `id` DESC LIMIT 5');Now! The Zend Framework way! I can't seam to find what would be the Zend equivilant of my get_list() function. The only thing I see is the fetchAll which I find to be silly because I don't want to fetch them all, just some. Also, I want to specify which rows I will be returning because in table with 30 some rows, all I need is 2.
The zend framework website seams to be down (no suprise) so I can't check there but I remember looking for it before and not being able to find any answers so now I ask you guys who might have some expierence with the framework.