PHP K�sikirja
Edellinen |  | Seuraava

# PDOStatement::fetchSingle

(no version information, might be only in CVS)

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

## Description

string PDOStatement::fetchSingle ( void )

Varoitus
Varoitus! T�m� funktio on EKSPERIMENTAALINEN. T�m�n funktion ominaisuudet, k�ytt�ytyminen, parametrit ja nimi voi muuttua varoituksetta seuraavissa PHP:n versioissa.

## Return values

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

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

## Examples

Esimerkki 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

## See Also

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

Edellinen | Alkuun | Seuraava
PDOStatement::fetchAll | Ylös | PDOStatement::getAttribute