SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: zend framework paging
-
Feb 12, 2008, 22:09 #1
- Join Date
- Jul 2006
- Posts
- 200
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
zend framework paging
Is there a way to page a database resultset in the zend framework? If so, where do you put all the code to do it?
I am new to frameworks but not to php. I checked the manual and couldn't find anything about paging records.
-
Feb 12, 2008, 22:21 #2
- Join Date
- Jul 2006
- Location
- planet earth
- Posts
- 276
- Mentioned
- 16 Post(s)
- Tagged
- 0 Thread(s)
I would use something like this
PHP Code://create Zend_Db_Select instance
$select = $db->select();
//add in our where conditions, this is obviously more then one line
$select->where('conditions');
//clone our conditions
$select2 = clone $select;
//we only want back the total number
$select2->from('table', array('totalrows' => 'COUNT(*)'));
//now we know how many records in total
$totalrows = $db->fetchOne($select2);
//with our original select, we can use paging
$select->from('table')
->limit($start, $end);
$rows = $db->fetchAll($select);
my utility belt tells me its to the bar batman
read the manual then google it then do a search THEN post....
-
Feb 13, 2008, 16:37 #3
- Join Date
- Jul 2006
- Posts
- 200
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
paging
I am new to frameworks, where would this code be placed?
For example I took the zend tutorial where you have:
id | artist | title.
With the existing application all working, where would this paging code go?
Thanks
-
Feb 13, 2008, 22:29 #4
- Join Date
- Jul 2006
- Location
- planet earth
- Posts
- 276
- Mentioned
- 16 Post(s)
- Tagged
- 0 Thread(s)
it would probably be best to have a read through how to use the Zend Framework first. I found this to be a good read
http://naneau.nl/2007/04/21/a-zend-f...rial-part-one/my utility belt tells me its to the bar batman
read the manual then google it then do a search THEN post....
Bookmarks