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];
$sql = "UPDATE ZITEM SET ZQUANTITY=0 WHERE ZPRODUCTID={$prodid}";
$sesdb->exec($sql);
On 20 Aug 2008, at 11:10, Evert Lammerts wrote:
A little time on google told me that if you want to do a write
after a
read (or the other way around) you need to free up the query
resource
- apparently they hold read / write locks.
so, free up $statement before doing a write:
$sesdb = new PDO('sqlite:file.sqlite3');
$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];
$sql = "UPDATE ZITEM SET ZQUANTITY='0' WHERE
ZPRODUCTID='{$prodid}'";
$sesdb->exec($sql);
}
On Wed, Aug 20, 2008 at 11:49 AM, Amy Gibbs <amy@xxxxxxxxxxxxxxxxxxxxxx
>
wrote:
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) {
$prodname=$product[0];
$prodqty = $product[1];
$prodid=$product[2];
$sql = "UPDATE ZITEM SET ZQUANTITY='0' WHERE ZPRODUCTID={$prodid}";
$sesdb->exec($sql);
}
On 20 Aug 2008, at 10:11, Evert Lammerts wrote:
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 <amy@xxxxxxxxxxxxxxxxxxxxxx
>
wrote:
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];
$prodid=$product[2];
$sql = "UPDATE ZITEM SET ZQUANTITY='0' WHERE ZPRODUCTID={$prodid}";
$sesdb->exec($sql);
}
On 20 Aug 2008, at 09:59, Evert Lammerts wrote:
$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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php