[prev in list] [next in list] [prev in thread] [next in thread] 

List:       solid
Subject:    ODBC/Solid/PHP3 wierdness workaround
From:       Siegfried Stepke <siegi () netz ! at>
Date:       1998-08-15 13:22:23
[Download RAW message or body]

Hello!

A few days ago I reported a strange error when updating rows out of
PHP (3.0.2a) in Solid.

After some testing I got it to run without errors, but this workaround
can't be the final solution:

In my app I need to update more than one row at once in a loop. To get
it work without errors, I have to disconnect and reconnect after each
statement!!!

for($i=0; $i <  count($stk); $i++) {
     $pid = key($stk);
     if ($stk[$pid] == 0) { // delete it
        $query = "delete from warenkorb where id='$sid' and fs_produkt=$pid";
     } else { // change it
        $query = "update warenkorb set stk=$stk[$pid] where id='$sid' and fs_produkt=$pid";
     }
     echo "<!-- $query -->\n";
!!   odbc_close($dbh);
!!   $dbh = odbc_connect($dsn, $solid_user, $solid_pass);
     if (!(odbc_exec($dbh,$query))) {
        odbc_rollback($dbh);
     } else {
        odbc_commit($dbh); // senseless in autocommit mode
     }
     next($stk);
   }
}

The setting of odbc_autocommit made no change.
Contrary to what I thought before, using odbc_connect instead of
odbc_pconnect didn't help.

I hope this can help some people.

bye,
siegi

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic