PDOStatement::fetchSingle

(no version information, might be only in CVS)

PDOStatement::fetchSingle --  Returns the first column in the next row of a result set

Popis

string PDOStatement::fetchSingle ( void )

Varovanie

T�to funkcia je EXPERIMENT�LNA. Spr�vanie tejto funkcie, n�zov tejto funkcie a hoci�o in� zdokumentovan� o tejto funkcii sa m�e zmeni� bez pov�imnutia v bud�com vydan� PHP. Pou��vajte t�to funkcii na svoje vlastn� riziko.

Vrátené hodnoty

PDOStatement::fetchSingle() returns the first column in the next row of a result set as a string value.

Varovanie

There is no way to return the second or subsequent columns from a row if you use this method to retrieve data.

Príklady

Príklad 1. Return first column of the next row

<?php
$sth
= $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

/* Fetch the first column from the next row in the result set */
print("Fetch the first column from the next row in the result set:\n");
$result = $sth->fetchSingle();
print(
"$result\n");

$result = $sth->fetchSingle();
print(
"$result\n");
?>

V�stup pr�kladu uveden�ho vy�ie bude:

Fetch the first column from the next row in the result set:
lemon
orange

Tiež pozri

PDO::query()
PDOStatement::fetch()
PDOStatement::fetchAll()
PDOStatement::prepare()
PDOStatement::setFetchMode()