Le Wed, 20 Aug 2008 07:48:02 +0000, KLEIN Stéphane a écrit :
> 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 ?
I found my mistake :
$ chmod ugo+rwX ../
It was the directory that had bad authorization.
Regards,
Stephane
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php