|
Posted by Oliver Grδtz on 11/22/07 19:06
Luigi schrieb:
> OK, I moved to PDO, but the problem still remains even if different as
> I write more over here belove
>
>> - Do you have unfinished transactions in your code?
>> A missing COMMIT will rollback your db at the end.
>
> There is, as you can see in the code below...
>
>> - Is the sqlite file write protected (win32) or not
>> writable by your web server user (linux)?
>
> -rw-rw-rw-
>
>> - Did you correctly configure the error_reporting
>> for your PHP installation?
>
> I don't know... this is the value I've got: 6143, but I have not idea
> about what it means... I'm a newbie...
That's the numeric value of the sum of your error level constants:
http://de.php.net/error_reporting
It means E_ALL, so you should see all types of error messages.
> try {
> $dbh = new PDO('sqlite:../sqlite/myslite.db');
Typo alert "myslite" vs "mysqlite"?
Are you working on the wrong database?
> $statement = "update myusers set passwd='".md5('xxx')."' where
> id='xxx'";
> echo $statement, "\n";
>
> $dbh->beginTransaction();
> $dbh->execute($statement);
This MUST yield an error message since PDO has no execute method:
Fatal error: Call to undefined method PDO::execute() in C:\test.php on
line 9
> $dbh->commit();
>
> $sth = $dbh->query('SELECT * from myusers');
> foreach($sth as $row) {
> echo $row['id'], "\n";
> }
> $dbh = null;
> } catch (PDOException $e) {
> print "Error!: " . $e->getMessage() . "<br/>";
> die();
> } catch (Exception $e) {
> $dbh->rollBack();
So you are only doing a rollback if the error is NOT a database error???
The script worked for me after changing to exec() and creating a mini
database.
OLLi
--
"No more Mr. Nice Gaius!!!"
[Baltar on Battlestar Galactica 107]
[Back to original message]
|