(no version information, might be only in CVS)
PDOStatement::fetch -- Fetches the next row from a result set警告 |
この関数は、 実験的なステータスにあります。これは、この関数の 動作、関数名、ここで書かれていること全てがPHPの将来のバージョンで予告 なく変更される可能性があることを意味します。注意を喚起するとともに自分 のリスクでこの関数を使用して下さい。 |
Fetches a row from a result set associated with a PDOStatement object.
fetch_style can be one of the following values:
PDO_FETCH_ASSOC: returns an array indexed by column name as returned in your result set
PDO_FETCH_BOTH (default): returns an array indexed by both column name and column number as returned in your result set
PDO_FETCH_BOUND: returns TRUE and assigns the values of the columns in your result set to the PHP variables to which they were bound with the PDO::bindParam() method
PDO_FETCH_LAZY: combines PDO_FETCH_BOTH and PDO_FETCH_OBJ, creating the object variable names as they are accessed
PDO_FETCH_OBJ: returns an anonymous object with property names that correspond to the column names returned in your result set
PDO_FETCH_NUM: returns an array indexed by column number as returned in your result set, starting at column 0
上の例の出力は以下となります:
PDO_FETCH_ASSOC: Return next row as an array indexed by column name Array ( [NAME] => apple [COLOUR] => red ) PDO_FETCH_BOTH: Return next row as an array indexed by both column name and number Array ( [NAME] => banana [0] => banana [COLOUR] => yellow [1] => yellow ) PDO_FETCH_LAZY: Return next row as an anonymous object with column names as properties PDORow Object ( [NAME] => orange [COLOUR] => orange ) PDO_FETCH_OBJ: Return next row as an anonymous object with column names as properties kiwi |