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.
The current fetch mode can be changed using
setFetchMode().
Potential values include:
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...
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$data =& $db->getAll('SELECT cf, nf, df FROM foo');
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getAll('SELECT cf, nf, 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->getAll('SELECT cf, nf, df FROM foo',
array(), DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getAll('SELECT cf, nf, df FROM foo',
array(), DB_FETCHMODE_ASSOC);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getAll('SELECT cf, nf, df FROM foo',
array(), DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getAll('SELECT cf, nf, 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->getAll('SELECT cf, nf, df FROM foo WHERE nf = ?',
array(5), DB_FETCHMODE_ASSOC);
if (PEAR::isError($data)) {
die($data->getMessage());
}
print_r($data);
?>