This method does not allow scalars to be used
for this argument.
integer
$fetchmode
the fetch mode to use.
The default is DB_FETCHMODE_DEFAULT,
which tells this method to use DB's current fetch mode.
DB's current default fetch mode can be changed using
setFetchMode().
Potential values include:
DB_FETCHMODE_ORDERED
DB_FETCHMODE_ASSOC
DB_FETCHMODE_OBJECT
Return value
array - the first row's data in an array
or a DB_Error object on failure.
The array may be ordered or associative depending on
$fetchmode.
The column index starts at 0 for orderd arrays.
Check the database related section of
PHP-Manual
to detect the reason for this error. In the most cases
a misformed SQL statment. Ie. using LIMIT in a SQL-Statment
for an Oracle database.
<?php
// Once you have a valid DB object named $db...
$data =& $db->getRow('SELECT cf, df FROM foo',
array(), DB_FETCHMODE_ORDERED);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getRow('SELECT cf, df FROM foo',
array(), DB_FETCHMODE_ASSOC);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
Output:
Array
(
[cf] => Juan
[df] => 1991-01-11 21:31:41
)
<?php
// Once you have a valid DB object named $db...
$data =& $db->getRow('SELECT cf, df FROM foo',
array(), DB_FETCHMODE_OBJECT);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getRow('SELECT cf, df FROM foo WHERE nf = ?',
array(5));
if (PEAR::isError($data)) {
die($data->getMessage());
}
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getRow('SELECT cf, df FROM foo WHERE nf IN (?, ?)',
array(5, 10));
if (PEAR::isError($data)) {
die($data->getMessage());
}
?>