SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    198
    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.

  2. #2
    Team SitePoint santouras's Avatar
    Join Date
    Jul 2006
    Location
    planet earth
    Posts
    273
    Mentioned
    10 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....

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    198
    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

  4. #4
    Team SitePoint santouras's Avatar
    Join Date
    Jul 2006
    Location
    planet earth
    Posts
    273
    Mentioned
    10 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •