Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:25:09+00:00 2026-05-31T10:25:09+00:00

I have a Zend_Paginator_Adapter_DbTableSelect object from this query: public function fetchPagedTracks() { $select =

  • 0

I have a Zend_Paginator_Adapter_DbTableSelect object from this query:

public function fetchPagedTracks() {

        $select = $this->select(Zend_Db_Table::SELECT_WITH_FROM_PART)
                       ->setIntegrityCheck(FALSE);
        $select->join(array('ar' => 'artist'), 'ar.id = track.artist_id',
                array('artist_name' => 'name'));
        $select->join(array('al' => 'album'), 'al.id = track.album_id',
                array('album_name' => 'name', 'artist_id', 'year'));
        $select->order('artist_name', 'ASC');
        $select->order('album_name');
        $select->order('track', 'ASC');

        //create a new instance of the paginator adapter and return it
        $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);

        return $adapter;
    }

The data returns as expected and works, my issue is with my viewscript. I want to iterate over the result set in a specific way. Basically i want to have the artist at the top of a table with sub tables for each album with the tracks listed in each in order. I have accomplished this…but not properly, I had to do what I feel is a hack and I’m hoping SO can help me fix it.

Here is the view:

<?php
echo $this->paginationControl(
        $this->paginator, 'Sliding', '_paginatorControl.phtml'
)
?>
<table>
    <?php
    foreach ($this->paginator as $track):;
//     Zend_Debug::dump($track, '');
        $artist = $track->artist_name;
        $album = $track->album_name;
        ?>
        <?php if ($end_artist != $artist): ?>
            <tr>
                <th colspan="4"><?php echo $track->artist_name ?></th>
            </tr>
        <?php endif ?>
        <?php if ($end_album != $album): ?>
            <tr>
                <th colspan="4"><?php echo $track->album_name . ' ' . $track->year ?></th>
            </tr>

        <tr>
            <th>Track #</th>
            <th>Title</th>
            <th>Bitrate</th>
            <th>Play Time</th>
        </tr>
        <?php endif; ?>
        <tr>
            <td><?php echo $track->track ?></td>
            <td><?php echo $track->title ?></td>
            <td><?php echo $track->bit_rate . 'Kbps' ?></td>
            <td><?php echo $this->playtime($track->play_time) ?></td>
        </tr>
        <?php
        $end_artist = $track->artist_name;
        $end_album = $track->album_name
        ?>

    <?php endforeach ?>
</table>
<?php
echo $this->paginationControl(
        $this->paginator, 'Sliding', '_paginatorControl.phtml'
); ?>

The big issue is that this code causes two notices:

Notice: Undefined variable: end_artist in
E:\www\home.local\application\modules\music\views\scripts\index\display.phtml
on line 13… and on line 18

The offending variables are $end_artist and $end_album and for life of me I can’t figure out how to do this a different way. Suggestions?

P.S. a dump of the paginator object can be seen at Pastbin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:25:10+00:00Added an answer on May 31, 2026 at 10:25 am

    It seems $end_artist and $end_album variables not defined before, put

    $end_artist = '';
    $end_album = '';
    

    before foreach

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a query like: SELECT DISTINCT unnest(test) AS test FROM table ORDER
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
I have this code. It's from the Zend Reading Mail example. $message = $mail->getMessage(1);
I have a Zend_Form_Element_Select object, and about 3k select options. When the customer asked
I have a Zend_Form with file element like this: ->addElement('file', 'image', array( 'required' =>
How to configure poedit to extract strings from xml file? I have Zend Framework
i have used zend pagination in my controller action.it returns zend paginator object that
i've followed the pagination tutorial from http://framework.zend.com/manual/en/zend.paginator.usage.html I have successfully implemented pagination for my
I want to store mysql query in zend registry because i have one action
I'm pretty sure this is not possible in Zend Framework (I have searched the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.