At 09:15 20/08/2008, you wrote:
Message-Id: <[EMAIL PROTECTED]>
From: Amy Gibbs <[EMAIL PROTECTED]>
Date: Wed, 20 Aug 2008 09:08:42 +0100
I've managed to connect to my database, and run a select query, but
now I need to run an UPDATE query and it just doesn't seem to take
effect.
Things I'd
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,
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
>
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
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
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
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
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
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
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
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
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];
$
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)
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
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
> $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
Hi,
I'm not very experienced in PHP, and have always used mysql with it,
but now I have a Sqlite database that I want to manipulate and I
thought PHP would be an easy way to do it. It turned out that I need
to use PDO to access a Sqlite V3 database, which is all new to me.
I've managed to
17 matches
Mail list logo