1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 13:17:58 +02:00

* added dibi::fetch, dibi::fetchAll, dibi::fetchSingle

* some bugs fixed
This commit is contained in:
David Grudl
2007-11-12 16:20:44 +00:00
parent d19eb5b815
commit 40444c1341
5 changed files with 61 additions and 14 deletions

View File

@@ -23,21 +23,26 @@ product_id | title
*/
// fetch a single row
$row = dibi::fetch('SELECT title FROM [products]');
print_r($row); // Chair
echo '<hr>';
// fetch a single value
$res = dibi::query('SELECT [title] FROM [products]');
$value = $res->fetchSingle();
$value = dibi::fetchSingle('SELECT [title] FROM [products]');
print_r($value); // Chair
echo '<hr>';
// fetch complete result set
$res = dibi::query('SELECT * FROM [products]');
$all = $res->fetchAll();
$all = dibi::fetchAll('SELECT * FROM [products]');
print_r($all);
echo '<hr>';
// fetch complete result set like association array
$res = dibi::query('SELECT * FROM [products]');
$assoc = $res->fetchAssoc('title'); // key
print_r($assoc);
echo '<hr>';