1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-20 09:16:30 +02:00
Files
php-dibi/examples/metatypes.php
David Grudl ac980fe8c9 + DibiResult::fetchAll()
* changed year in headers (2007)
2007-01-08 00:55:11 +00:00

35 lines
643 B
PHP

<pre>
<?php
require_once '../dibi/dibi.php';
// mysql
dibi::connect(array(
'driver' => 'mysqli',
'host' => 'localhost',
'username' => 'root',
'password' => 'xxx', // change to real password!
'database' => 'dgx',
'charset' => 'utf8',
));
$res = dibi::query('SELECT * FROM [nucleus_item] WHERE [inumber] <> %i', 38);
if (!$res) die('SQL error');
// auto-convert this field to integer
$res->setType('inumber', Dibi::FIELD_INTEGER);
$record = $res->fetch();
var_dump($record);
// auto-detect all types
$res->setType(TRUE);
$record = $res->fetch();
var_dump($record);
?>