1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-21 17:58:02 +02:00
Files
php-dibi/examples/metatypes.php
David Grudl 0c86515076 * modified DibiException (getDbError, ...)
* fix dibi::dumpResult()
2007-02-02 03:51:43 +00:00

33 lines
624 B
PHP

<pre>
<?php
require_once '../dibi/dibi.php';
// CHANGE TO REAL PARAMETERS!
dibi::connect(array(
'driver' => 'mysql',
'host' => 'localhost',
'username' => 'root',
'password' => 'xxx',
'database' => 'dibi',
'charset' => 'utf8',
));
$res = dibi::query('SELECT * FROM [mytable] 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);