Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
Forget my last mail. Good to hear it's solved. On Wed, Aug 20, 2008 at 1:20 PM, Evert Lammerts <[EMAIL PROTECTED]> wrote: > Can you post the code you're using when you get the timeout? > > I guess you already tried to do a select only and an update only to > check if it works? > > On Wed, Aug 20,

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
Can you post the code you're using when you get the timeout? I guess you already tried to do a select only and an update only to check if it works? On Wed, Aug 20, 2008 at 1:11 PM, Amy Gibbs <[EMAIL PROTECTED]> wrote: > OK, I found one problem, the database file was not writeable, I added this >

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
OK, I found one problem, the database file was not writeable, I added this code to find the error: $sesdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); then I got the following error: Warning: PDO::exec() [function.PDO-exec]: SQLSTATE[HY000]: General error: 14 unable to open databa

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
It seems you've figured it out. I think you only need to chmod the DB directory and you're good to go. On Wed, Aug 20, 2008 at 1:04 PM, Amy Gibbs <[EMAIL PROTECTED]> wrote: > OK, I found one problem, the database file was not writeable, I added this > code to find the error: > $sesdb->setAttribute

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
OK, I found one problem, the database file was not writeable, I added this code to find the error: $sesdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); However, I now get the following error: Warning: PDO::exec() [function.PDO-exec]: SQLSTATE[HY000]: General error: 14 unable to ope

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
Alright, getting somewhere. Try this: $sesdb = new PDO('sqlite:wtc.sqlite3'); if ($sesdb->exec("UPDATE ZITEM SET ZQUANTITY=0 WHERE ZPRODUCTID='bli-343'") === false) { echo $sesdb->errorInfo(); } Don't forget the quotes around the product id (it's a string so you need them after all) On Wed, Au

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
It still doesn't run the update, but the var_dump displays bool(false) bool(false) $sesdb = new PDO('sqlite:wtc.sqlite3'); $sql = "UPDATE ZITEM SET ZQUANTITY=0 WHERE ZPRODUCTID=bli-343"; var_dump($sesdb->exec("UPDATE ZITEM SET ZQUANTITY=0 WHERE ZPRODUCTID=bli-343")); $sesdb->exec($sql); var

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
What happens if you try the UPDATE before a SELECT? $sesdb = new PDO('sqlite:file.sqlite3'); var_dump($sesdb->exec("UPDATE ZITEM SET ZQUANTITY=0 WHERE ZPRODUCTID=1")); On Wed, Aug 20, 2008 at 12:42 PM, Evert Lammerts <[EMAIL PROTECTED]> wrote: > Sorry, I'm out of options. Hopefully somebody on th

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
Thanks for trying, On 20 Aug 2008, at 11:42, Evert Lammerts wrote: Sorry, I'm out of options. Hopefully somebody on the list has a little more experience with PDO. On Wed, Aug 20, 2008 at 12:26 PM, Amy Gibbs <[EMAIL PROTECTED] > wrote: It's still not working :( $query="SELECT ZNAME, ZQUANTIT

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
Sorry, I'm out of options. Hopefully somebody on the list has a little more experience with PDO. On Wed, Aug 20, 2008 at 12:26 PM, Amy Gibbs <[EMAIL PROTECTED]> wrote: > It's still not working :( > $query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE ZCategory != > 14"; > $statement= $sesd

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
It's still not working :( $query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE ZCategory != 14"; $statement= $sesdb->query($query); $result=$statement->fetchAll(); $statement=null; foreach ($result as $product) { $prodname=$product[0]; $prodqty = $product[1]; $prodid=$product[2]; $

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
No errors reported, but it's not updating the db, error_reporting(E_ALL); $sesdb = new PDO('sqlite:file.sqlite3'); $query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE ZCategory != 14"; $statement= $sesdb->query($query); $result=$statement->fetchAll(); foreach ($result as $product)

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
can you put error_reporting(E_ALL); somewhere above the query and check if there's some output? On Wed, Aug 20, 2008 at 11:02 AM, Amy Gibbs <[EMAIL PROTECTED]> wrote: > still not working, > > > $sesdb = new PDO('sqlite:file.sqlite3'); > > $query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHE

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Amy Gibbs
still not working, $sesdb = new PDO('sqlite:file.sqlite3'); $query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE ZCategory != 14"; $statement= $sesdb->query($query); $result=$statement->fetchAll(); foreach ($result as $product) { $prodname=$product[0]; $prodqty = $product[1]; $prod

Re: [PHP-DB] Sqlite 3 pdo update query problem

2008-08-20 Thread Evert Lammerts
> $sql = "UPDATE ZITEM SET ZQUANTITY='0' WHERE ZPRODUCTID='".$prodid."'"; Try to unquote $prodid: $sql = "UPDATE ZITEM SET ZQUANTITY='0' WHERE ZPRODUCTID={$prodid}"; Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php