php and sqlite3 can select but not insert file is set rw
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
php and sqlite3 can select but not insert file is set rw
Hello,
I am trying to get started with sqlite3. Seams there is still
something wrong with my setup.
I am stuck and was wondering if someone could give me a hand.
I can select but it wont let me insert or update the database. The
error is "unable to open database file" however it does open the file
for a select query.
I think my code is fine because it works with a memory db. However I
will include the code below.
I also tried adding the 0666 to sqlite3_open but that does not work
either. My file is saved as rw for all.
sqlite3_open('db.sqlite', 0666) <= Does not work
-rw-rw-rw- 1 www-data www-data 2048 2007-01-25 02:31 db.sqlite
By the way I had to create the db.sqlite file from command line it
would not create it from php. So I also inserted some data from
command line. That is how I now that the select query works.
One more note, when I create the db in memory insert, update, create
table all works. But then when I commend out the create table line and
check my data it gives me the error that there is no table called
newuser in the db/memory.
Shouldn't that table be around for a little longer. I tried it with
not closing the db but it is still gone the second time I execute the
script. I am not planning on using a memory db so I could do with out
this. I just included this in case there is a relation.
Thank you
Dennis
=============
My test Code:
<?php
if ( ! $db = sqlite3_open("db.sqlite")) {
echo "Error db open: " . sqlite3_error($db);
}
$sqlCreateTable = 'CREATE TABLE newuser(id INTEGER PRIMARY KEY, email
CHAR(256), key CHAR(255))';
//$query = sqlite3_exec($db, $sqlCreateTable); // This only works in memory db
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.