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

search for in the

SQLite3::query> <SQLite3::open
[edit] Last updated: Fri, 17 May 2013

view this page in

SQLite3::prepare

(PHP 5 >= 5.3.0)

SQLite3::preparePreparar una sentencia SQL para su ejecución

Descripción

public SQLite3Stmt SQLite3::prepare ( string $query )

Prepara una sentencia SQL para su ejecución y devuelve un objeto de la clase SQLite3Stmt.

Parámetros

query

La consulta SQL a preparar.

Valores devueltos

Devuelve un objeto de la clase SQLite3Stmt en caso de éxito o FALSE en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de SQLite3::prepare()

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

$bd->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$bd->exec("INSERT INTO foo (id, bar) VALUES (1, 'Esto es una prueba')");

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

$resultado $sentencia->execute();
var_dump($resultado->fetchArray());
?>



add a note add a note User Contributed Notes SQLite3::prepare - [1 notes]
up
0
pavel dot lisa at centrum dot cz
2 years ago
SQLite3::prepare() will fail, if you pass in a WHERE clause (in the $query) referring to a non-existent column.

 
show source | credits | sitemap | contact | advertising | mirror sites