Manuel PHP

SQLite3::prepare

(No version information available, might be only in CVS)

SQLite3::preparePrepares an SQL statement for execution

Description

public SQLite3_stmt SQLite3::prepare ( string $query )

Prepares an SQL statement for execution and returns an SQLite3_stmt object.

Liste de paramètres

query

The SQL query to prepare.

Valeurs de retour

Returns an SQLite3_stmt object on success or FALSE on failure.

Exemples

Exemple #1 SQLite3::prepare() example

  1. <?php
  2. unlink('mysqlitedb.db');  
  3. $db = new SQLite3('mysqlitedb.db');  
  4.  
  5. $db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');  
  6. $db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");  
  7.  
  8. $stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');  
  9. $stmt->bindValue(':id', 1, SQLITE3_INTEGER);  
  10.  
  11. $result = $stmt->execute();  
  12. var_dump($result->fetchArray());  
  13. ?> 


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique