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

search for in the

SQLite3::lastErrorCode> <SQLite3::escapeString
[edit] Last updated: Wed, 22 May 2013

view this page in

SQLite3::exec

(PHP 5 >= 5.3.0)

SQLite3::execEjecutar una consulta que no devuelve resultados en una base de datos dada

Descripción

public bool SQLite3::exec ( string $query )

Ejecuta una consulta que no devuelve resultados en una base de datos dada.

Parámetros

query

La consulta SQL a ejecutar (típicamente una consulta INSERT, UPDATE, o DELETE).

Valores devueltos

Devuelve TRUE si la consulta tuvo éxito, FALSE en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de SQLite3::exec()

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

$bd->exec('CREATE TABLE bar (bar STRING)');
?>



SQLite3::lastErrorCode> <SQLite3::escapeString
[edit] Last updated: Wed, 22 May 2013
 
add a note add a note User Contributed Notes SQLite3::exec - [3 notes]
up
1
moodsey211 at gmail dot com
2 years ago
If you get the error message saying "SQLite3::exec. database locked." You just need to define a busyTimeout to work around this.
up
0
gamag
2 months ago
SQLite needs to create some temp-files (journals...) to execute certain statements, so php needs write-permission in your db-directory.
up
-3
info at tellmatic dot org
4 months ago
IMPORTANT! just a note:

weird behaviour when doing an exec on a sqlite db!!!

if want to execute a query on a sqlite db with exec, and your dbfile already was e.g. mode 777, and you get some php errors saying

"SQLite3::exec(): unable to open database file in ...."

and you get crazy while debugging, just add write üermissions to the whole directory for the user the webserver/php runs.

this behaviour makes absolutely NO sense, and is a source of frustration.
at least a more meaningful errormessage would be nice.
i couldnt figure out why sqlite needs write permissions for the whole dir instead of only one file. this is stupid and must be a bug!
(to be secure you have to create a directory with write permissions only for php/apache)

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