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 Kaplan ============= 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 $query="INSERT INTO newuser (email,key) VALUES ('Tim','225')"; if (! $dbRes = sqlite3_exec($db, $query) ) { echo "Error Insert: " . sqlite3_error($db); } else { echo "Changes: " . sqlite3_changes($db); } $query=sqlite3_query($db,"UPDATE newuser SET email = 'Tina' WHERE id = 1"); if (!$query) { echo "Error query Update: " . sqlite3_error($db); } else { $query = sqlite3_query($db, "SELECT * from newuser"); $rows = array(); while ($r = sqlite3_fetch_array($query)) { print_a($r); } } sqlite3_query_close($query); sqlite3_close($db); ?> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------