previousStructures_DataGrid::attachRenderer (Previous) (Next) Structures_DataGrid::bindDataSourcenext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Structures_DataGrid::bind

Structures_DataGrid::bind() – A simple way to add a record set to the datagrid

Synopsis

require_once 'Structures/DataGrid.php';

bool Structures_DataGrid::bind ( mixed $container , array $options = array() , string $type = null )

Description

This package is not documented yet.

Parameter

mixed $container

The record set in any of the supported data source types

array $options

Optional. The options to be used for the data source

string $type

Optional. The data source type

Return value

returns True if successful, otherwise PEAR_Error.

Throws

throws no exceptions thrown

Examples

Bind an SQL query

<?php
// Setup your database connection
$options = array('dsn' => 'mysql://user:password@host/db_name');

// Bind a basic SQL statement as datasource
// Note: ORDER BY and LIMIT clause are automatically added
$test $datagrid->bind('SELECT * FROM my_table'$options);

// Print binding error if any
if (PEAR::isError($test)) {
    echo 
$test->getMessage();
}
?>

Bind a DB_DataObject

<?php
$person 
= new DataObjects_Person;

$person->hair 'red';
$person->has_glasses 1;

$datagrid->bind($person);
?>

Note

This function can not be called statically.

previousStructures_DataGrid::attachRenderer (Previous) (Next) Structures_DataGrid::bindDataSourcenext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.