PDO::prepare

(no version information, might be only in CVS)

PDO::prepare --  Prepares a statement for execution and returns a statement object

Description

PDOStatement PDO::prepare ( string statement [, int options])

警告

この関数は、 実験的なステータスにあります。これは、この関数の 動作、関数名、ここで書かれていること全てがPHPの将来のバージョンで予告 なく変更される可能性があることを意味します。注意を喚起するとともに自分 のリスクでこの関数を使用して下さい。

Prepares an SQL statement to be executed by the statement-handle PDO::execute() method. The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers.

例 1. Prepare and execute an SQL statement

<?php
/* Execute a prepared statement by passing an array of values */
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour'
);
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
?>