Re: PEAR DB & PAGER & array_push

From: Date: Sun, 14 Nov 2004 09:07:23 +0000
Subject: Re: PEAR DB & PAGER & array_push
References: 1  Groups: php.general php.pear.general 
Request: Send a blank email to pear-general+get-15488@lists.php.net to get a copy of this message
valerie17@telkom.net 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

« previous php.pear.general (#15488) next »