| Olivier Guilyardi 2006-05-22, 7:04 pm |
| Hi Dominik,
Please ask your questions on the pear-general mailing list at :
pear-general@lists.php.net
I'm cc'ing this mail to the said mailing list. See my comments below.
ToPPi wrote:
>
> I have a slight problem with datagrid. maybe you'll see it on first look.
> i just took the example provided with the pear package,
> but i get the "Unable to determine the data source type. You may want to
> explicitly specify it." error.
>
> This is my source:
> ---
> <?php
> require 'Structures/DataGrid.php';
>
> // 10 records per page
> $datagrid =& new Structures_DataGrid(10);
>
> // Setup your datasource
> $options = array('dsn' =>
> 'mysql://root:mypass@127.0.0.1/information_schema');
> $test = $datagrid->bind("SELECT * FROM STATISTICS", $options);
> // This is just a database that is shipped with mysql5 (default)
>
>
> if (PEAR::isError($test)) {
> echo $test->getMessage();
> }
>
> // Print the DataGrid with the default renderer (HTML Table)
> $test = $datagrid->render();
> if (PEAR::isError($test)) {
> echo $test->getMessage();
> }
>
> // Print the HTML paging links
> $test = $datagrid->render(DATAGRID_RENDER_PAGER);
> if (PEAR::isError($test)) {
> echo $test->getMessage();
> }
>
> ?>
>
> ---
>
>
> What am i doing wrong?
> I tried to find out more about bind(), but the options/types arent
> documented.
You are directly binding an SQL statement with :
$datagrid->bind("SELECT * FROM STATISTICS", $options);
This is a new feature.
That's our fault : the manual documents the upcoming 0.7 release of
Structures_DataGrid, while you are certainly using the current 0.6.3 release.
Please checkout the current CVS with :
cvs -d:pserver:cvsread@cvs.php.net:/repository login
(password: phpfi)
cvs -d:pserver:cvsread@cvs.php.net:/repository co pear/Structures_DataGrid
You should be fine.
Greetings
--
og
|