PDOStatement::fetchSingle
(no version information, might be only in CVS)
PDOStatement::fetchSingle --
Returns the first column in the next row of a result set
Descrizione
string
PDOStatement::fetchSingle ( void )
Avvertimento |
Questa funzione è
SPERIMENTALE. Ovvero, il comportamento di questa funzione,
il nome di questa funzione, in definitiva tutto ciò che è documentato qui
può cambiare nei futuri rilasci del PHP senza preavviso. Siete avvisati, l'uso di questa
funzione è a vostro rischio. |
Valori restituiti
PDOStatement::fetchSingle() returns the first column
in the next row of a result set as a string value.
Avvertimento |
There is no way to return the second or subsequent columns from a row
if you use this method to retrieve data.
|
Esempi
Esempio 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"); ?>
|
The above example will output: Fetch the first column from the next row in the result set:
lemon
orange |
|
Vedere anche:
PDO::query() |
PDOStatement::fetch() |
PDOStatement::fetchAll() |
PDOStatement::prepare() |
PDOStatement::setFetchMode() |