Re: [PEAR] PEAR DB & PAGER & array_push

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



valerie17@xxxxxxxxxx wrote:
Salut!
is there a good way to present data from table (many fields / not only one)
into $itemData instead of array_push (line 12 .. 16) ?

====================================== <?php /** * PEAR DB */ require_once 'DB.php';

$db    = DB::connect("mysql://valerie:@localhost/valerie");
$query = 'SELECT id, name FROM country';

/**
 * PEAR Pager Wrapper (this is the file stored
 * in the /examples/ dir of the PEAR::Pager package).
 * @see http://cvs.php.net/pear/Pager/examples/Pager_Wrapper.php
 */
require_once 'Pager/Wrapper.php';

$params = array(
    'mode'    => 'Jumping',
    'perPage' => 30,
    'delta'   => 5,
);
$page  = Pager_Wrapper_DB($db, $query, $params);
echo $page['links'];
?>
<table border="1">
  <tr>
    <th>ID</th>
    <th>Country</th>
  </tr>
<?php
  foreach($page['data'] as $country) {
    echo '<tr>';
    echo '<td>'. $country['id']   .'</td>';
    echo '<td>'. $country['name'] .'</td>';
    echo '</tr>';
  }
?>
</table>

======================================

HTH

Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux