Runs the query provided and returns the
data from the first column of the first row
then frees the result set.
Parameter
string
$query
the SQL query or the statement to prepare
mixed
$params
array, string or numeric data to be added to the prepared statement.
Quantity of items passed must match quantity of placeholders in the
prepared statement: meaning 1 placeholder for non-array
parameters or 1 placeholder per array element.
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->getOne('SELECT cf FROM foo');
if (PEAR::isError($data)) {
die($data->getMessage());
}
echo "$data\n";
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getOne('SELECT cf FROM foo WHERE nf = ?',
5);
if (PEAR::isError($data)) {
die($data->getMessage());
}
echo "$data\n";
?>
<?php
// Once you have a valid DB object named $db...
$data =& $db->getOne('SELECT cf FROM foo WHERE nf IN (?, ?)',
array(5, 10));
if (PEAR::isError($data)) {
die($data->getMessage());
}
echo "$data\n";
?>