For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > January 2005 > Re: [PEAR] Re: Structures_DataGrid installation issues: only returns









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Re: Structures_DataGrid installation issues: only returns
bertrand Gugger

2005-01-28, 8:57 pm

Hi sandro:
It's working by me 0.6.0 beta
just I changed your
> // Get my data
> $dataset = array(array('id' => 1,

in
> // Get my data
> $dataSet = array(array('id' => 1,

to accord to;
> $dg->bind($dataSet);

Tell me it's bloody.
à+
--
bertrand Gugger (toggg)
<?php
require('Structures/DataGrid.php');

// Get my data
$dataSet = array(array('id' => 1,
'first_name' => 'Bob',
'last_name' => 'Smith',
'age' => '37'),
array('id' => 2,
'first_name' => 'John',
'last_name' => 'Doe',
'age' => '23'),
array('id' => 3,
'first_name' => 'Fred',
'last_name' => 'Thompson',
'age' => '58'),
array('id' => 4,
'first_name' => 'Sally',
'last_name' => 'Robinson',
'age' => '52'),
array('id' => 5,
'first_name' => 'Robert',
'last_name' => 'Brown',
'age' => '19'));

// Print the DataGrid
$dg =& new Structures_DataGrid();
$dg->bind($dataSet);
$dg->render();
?>
[bertrand@magister bertrand]$ php sandro.php
Content-type: text/html
X-Powered-By: PHP/4.3.10

<table>
<tr>
<th width="25%"><a
href="?orderBy=id&direction=ASC">id</a></th>
<th width="25%"><a
href="?orderBy=first_name&direction=ASC">first_name</a></th>
<th width="25%"><a
href="?orderBy=last_name&direction=ASC">last_name</a></th>
<th width="25%"><a
href="?orderBy=age&direction=ASC">age</a></th>
</tr>
<tr>
<td width="25%">1</td>
<td width="25%">Bob</td>
<td width="25%">Smith</td>
<td width="25%">37</td>
</tr>
<tr>
<td width="25%">2</td>
<td width="25%">John</td>
<td width="25%">Doe</td>
<td width="25%">23</td>
</tr>
<tr>
<td width="25%">3</td>
<td width="25%">Fred</td>
<td width="25%">Thompson</td>
<td width="25%">58</td>
</tr>
<tr>
<td width="25%">4</td>
<td width="25%">Sally</td>
<td width="25%">Robinson</td>
<td width="25%">52</td>
</tr>
<tr>
<td width="25%">5</td>
<td width="25%">Robert</td>
<td width="25%">Brown</td>
<td width="25%">19</td>
</tr>
</table>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com