PDOStatement::fetchSingle
(no version information, might be only in CVS)
PDOStatement::fetchSingle --
Returns the first column in the next row of a result set
Leírás
string
PDOStatement::fetchSingle ( void )
Figyelem |
Ez a függvény
KÍSÉRLETI JELLEGGEL MŰKÖDIK. A függvény
működése, neve, bármi amit a függévénnyel kapcsolatban
dokumentáltunk megváltozhat egy későbbi PHP kiadásban minden
figyelmeztetés nélkül. Ezt a függvényt csak a saját
felelősségedre használd! |
Visszatérési értékek
PDOStatement::fetchSingle() returns the first column
in the next row of a result set as a string value.
Figyelem |
There is no way to return the second or subsequent columns from a row
if you use this method to retrieve data.
|
Példák
Példa 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"); ?>
|
A fenti példa a következő kimenetet adja: Fetch the first column from the next row in the result set:
lemon
orange |
|
Lásd még
PDO::query() |
PDOStatement::fetch() |
PDOStatement::fetchAll() |
PDOStatement::prepare() |
PDOStatement::setFetchMode() |