最終更新:2010-03-29 (月) 05:18:11 (5136d)  

PDOStatement
Top / PDOStatement

http://jp2.php.net/manual/ja/class.pdostatement.php

疑問符プレースホルダ

$stmt=$pdo->prepare("select * from hoge where id=?");
$stmt->execute(array(パラメータの配列));
$data = $stmt->fetch(PDO::FETCH_ASSOC);

名前付けされたプレースホルダ

$stmt=$pdo->prepare("select * from hoge where id=:param");
$stmt->bindParam(":param",$param);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);

メソッド

bool bindColumn ( mixed $column , mixed &$param [, int $type [, int $maxlen [, mixed $driverdata ]]] )
bool bindParam ( mixed $parameter , mixed &$variable [, int $data_type [, int $length [, mixed $driver_options ]]] )
bool bindValue ( mixed $parameter , mixed $value [, int $data_type ] )
bool closeCursor ( void )
int columnCount ( void )
bool debugDumpParams ( void )
string errorCode ( void )
array errorInfo ( void )
bool execute ([ array $input_parameters = array() ] )
mixed fetch ([ int $fetch_style = PDO::FETCH_BOTH [, int $cursor_orientation = PDO::FETCH_ORI_NEXT [, int $cursor_offset = 0 ]]] )
array fetchAll ([ int $fetch_style = PDO::FETCH_BOTH [, int $column_index [, array $ctor_args = array() ]]] )
string fetchColumn ([ int $column_number = 0 ] )
mixed fetchObject ([ string $class_name [, array $ctor_args ]] )
mixed getAttribute ( int $attribute )
array getColumnMeta ( int $column )
bool nextRowset ( void )
int rowCount ( void )
bool setAttribute ( int $attribute , mixed $value )
bool setFetchMode ( int $mode )