bool
Structures_DataGrid::bind
(
mixed
$container
,
array
$options = array()
,
string
$type
= null
)
This package is not documented yet.
$container
The record set in any of the supported data source types
$options
Optional. The options to be used for the data source
$type
Optional. The data source type
returns True if successful, otherwise PEAR_Error.
throws no exceptions thrown
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);
?>
This function can not be called statically.