File: bind-sql.php

package info (click to toggle)
php-structures-datagrid 0.9.3-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 408 kB
  • ctags: 876
  • sloc: php: 2,576; xml: 222; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 365 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
<?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(); 
}
?>