I'm trying to use php to maniupltate an sqlite database using the
following code, but it doesn't seem to be running the update query.
I'm not getting any error, but the datbase values are not changing.
Can anyone help?
<?php
error_reporting(E_ALL);
$inv=file('audit.txt');
$sesfile = "wtc.sqlite3";
$sesdb = new PDO('sqlite:wtc.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);
$sesdb2 = null;
}
$query="SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE
ZCategory != 14";
$statement2 = $sesdb->query($query);
$result2 = $statement2->fetchAll();
echo "<table>";
foreach ($result2 as $product) {
echo "<tr><td>".$product[0]."</td><td>".$product[1]."</td><td>".
$product[2]."</td></tr>";
}
echo "</table>";
?>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users