downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SQLite3Stmt::clear> <SQLite3Stmt::bindParam
Last updated: Fri, 13 Nov 2009

view this page in

SQLite3Stmt::bindValue

(PHP 5 >= 5.3.0)

SQLite3Stmt::bindValueパラメータの値を変数にバインドする

説明

public bool SQLite3Stmt::bindValue ( string $sql_param , mixed $value [, int $type ] )

パラメータの値を変数にバインドします。

パラメータ

sql_param

値をどの変数にバインドするかを表す文字列。

value

変数にバインドする値。

type

バインドする値のデータ型。

  • SQLITE3_INTEGER: 符号付き整数。 値の大きさに応じて 1, 2, 3, 4, 6, あるいは 8 バイトで格納されます。

  • SQLITE3_FLOAT: 浮動小数点数値。 8 バイトの IEEE 浮動小数点数値として格納されます。

  • SQLITE3_TEXT: テキスト文字列。 データベースのエンコーディング (UTF-8, UTF-16BE あるいは UTF-16-LE) を用いて格納されます。

  • SQLITE3_BLOB: blob データ。 入力がそのままの形式で格納されます。

  • SQLITE3_NULL: NULL 値。

返り値

値を変数にバインドした場合に TRUE、 失敗した場合に FALSE を返します。

例1 SQLite3Stmt::bindValue() の例

<?php
unlink
('mysqlitedb.db');
$db = new SQLite3('mysqlitedb.db');

$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");

$stmt $db->prepare('SELECT bar FROM foo WHERE id=:id');
$stmt->bindValue(':id'1SQLITE3_INTEGER);

$result $stmt->execute();
var_dump($result->fetchArray());
?>



add a note add a note User Contributed Notes
SQLite3Stmt::bindValue
There are no user contributed notes for this page.

SQLite3Stmt::clear> <SQLite3Stmt::bindParam
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites