if ($db = new SQLiteDatabase('filename'))
Also, do you need to specify the sqlite: protocol before the path? Does the system even know what this path is? One further note; you are using a relative path, but is it relative to the right location? Does it have to be relative to the system runtime or the PHP file? Try an absolute path to see if that fixes it.
Ash www.ashleysheridan.co.uk |
--- Begin Message ---
- To: php-general@xxxxxxxxxxxxx
- Subject: PDO, sqlite write requests (INSERT) don't working
- From: KLEIN Stéphane <stephane@xxxxxxxxxxxxxxxx>
- Date: Wed, 20 Aug 2008 07:48:02 +0000 (UTC)
- Delivery-date: Wed, 20 Aug 2008 08:48:30 +0100
- Envelope-to: ash@xxxxxxxxxxxxxxxxxxxx
- Sender: news <news@xxxxxxxxxxxxx>
- User-agent: Pan/0.132 (Waxed in Black)
Hi, it's the first time I use sqlite in PHP script. All read requests work perfectly but I don't get on execute write requests. Example : <?php try { $dbh = new PDO("sqlite:../example1.sqlite", '', ''); } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } var_dump($dbh); $firstname = "foobarbbar"; $lastname = "barbarbar"; try { $sql = "INSERT INTO contact (firstname, lastname) VALUES('".addslashes($firstname)."', '".addslashes($lastname)."')"; $result = $dbh->exec($sql); var_dump($result); } catch(PDOExecption $e) { print "Error!: " . $e->getMessage() . "</br>"; } ?> $ ls ../ -lha ... -rw-rw-rw- 1 stephane stephane 237K 2008-08-19 21:09 example1.sqlite ... When I launch this script INSERT request don't work, nothing is inserted in contact table. var_dump($result) return : bool(false) Have you already see this issue ? What is my mistake ? Thanks for your help, Stephane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php