title: unexpected warning in zend pagination
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2630013/invalid-argument-supplied-for-foreach">Invalid argument supplied for foreach()</a>  </p>
  </blockquote>
  
  
  
  <p>my controllar action is </p>
  
  <pre><code>public function indexAction(){
   Zend_View_Helper_PaginationControl::setDefaultViewPartial('index.phtml');
    $params = array('host'        =&gt;'localhost',
                    'username'    =&gt;'root',
                          'password'  =&gt;'',
                          'dbname'    =&gt;'test'
                           );
     $db = new Zend_Db_Adapter_Pdo_Mysql($params);
      $select = $db-&gt;select()-&gt;from('tableviewdemo');
      $paginator = Zend_Paginator::factory($select);
  
      $paginator-&gt;setCurrentPageNumber($this-&gt;_getParam('page', 1));
      $paginator-&gt;setItemCountPerPage(10);
      $this-&gt;view-&gt;paginator=$paginator;
  }
  </code></pre>
  
  <p>and view file is </p>
  
  <pre><code>&lt;?  echo "&lt;table border=1&gt;";
  foreach ($this-&gt;paginator as $item) {
  echo '&lt;tr&gt;&lt;td&gt;' . $item['id'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $item['name'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $item['city'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $item['state'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $item['date'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $item['zip'] . '&lt;/td&gt;&lt;/tr&gt;';}
  echo "&lt;/table&gt;";
  echo $this-&gt;paginationControl($this-&gt;paginator,'Sliding','/test/index.phtml'); ?&gt;
  </code></pre>
  
  <p>it is showing error
  table and pagelink as following
  First | &lt; Previous | Next > | Last </p>
  
  <p>and warning 
  Warning: Invalid argument supplied for foreach() in C:\Users\Administrator\hello\application\views\scripts\test\index.phtml
  why this happening????</p>