Re: [PHP-DB] sqlite

2011-11-30 Thread Tamara Temple
David McGlone da...@dmcentral.net wrote:
 On Tue, 2011-11-29 at 16:31 -0600, Tamara Temple wrote:
  David McGlone da...@dmcentral.net wrote:
   places.sqlite is mozilla's bookmarks db and I was trying to read this
   db, but so far I've been unsuccessful.
   
   sqlite ver: 2.8.17
   PHP version: PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch
   php5-sqlite: 5.3.3-1ubuntu9.6
  
  Okay, first off, mozilla uses sqlite3, not sqlite2, so you need to use
  those functions/classes instead.
 
 Thank you Tamara.. I'll see what I can accomplish. I'm thinking even if
 I do it this way, I'll still have to restart firefox for the page to
 update.

That I do not know. I would have assumed since they are using sqlite3,
that they would do an update whenever a bookmark was saved, but that may
not be be a valid assumption.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] sqlite

2011-11-29 Thread Tamara Temple
David McGlone da...@dmcentral.net wrote:
 places.sqlite is mozilla's bookmarks db and I was trying to read this
 db, but so far I've been unsuccessful.
 
 sqlite ver: 2.8.17
 PHP version: PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch
 php5-sqlite: 5.3.3-1ubuntu9.6

Okay, first off, mozilla uses sqlite3, not sqlite2, so you need to use
those functions/classes instead.

 try
 {
   //create or open the database
   $database = new SQLiteDatabase('places.sqlite', 0666, $error);
 }
 catch(Exception $e)
 {
   die($error);
 }
 
 $query = SELECT * FROM moz_bookmarks;
 
 if($result = $database-query($query, SQLITE_BOTH, $error))
 {
   while($row = $result-fetch())
   {
 echo (ID: {$row['id']} br / );
   }
 }
 else
 {
   die($error);
 }
 

Using SQLite3, this works, dumping the first record:

?php
$db = new SQLite3('places.sqlite');
$result = $db-query(select * from moz_bookmarks);
var_dump($result-fetchArray());

 But if I use this code:
 
 try 
 {
 /*** connect to SQLite database ***/
 
 $dbh = new PDO(sqlite:places.sqlite);
 echo Handle has been created .. brbr;
 
 
 }
 catch(PDOException $e)
 {
 echo $e-getMessage();
 echo brbrDatabase -- NOT -- loaded successfully .. ;
 die( brbrQuery Closed !!! $error);
 }
 
 echo Database loaded successfully ;
 
 I get the expected output, but can't figure out how to change the above
 script to echo the contents of the DB. I just get the two messages and
 that's it.

This works as it does because PDO uses SQLite3.

Read http://us.php.net/manual/en/book.pdo.php thoroughly.

To submit a query using PDO, it's just:

$result = $dbh-query('select * from moz_bookmarks');

which returns an object of PDOStatement class in $result. Then you can
just loop on $result-fetch() to deal with each row.

This is a PDO version of the above:

try {
  $db = new PDO('sqlite:places.sqlite');
}
catch (PDOException $e) {
  die(SQLite connection failed .$e-getMessage());
}

if ($result = $db-query(select * from moz_bookmarks)) {
  var_dump($result-fetch());
} else {
  die(Query failed.);
}

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] sqlite

2011-11-29 Thread David McGlone
On Tue, 2011-11-29 at 16:31 -0600, Tamara Temple wrote:
 David McGlone da...@dmcentral.net wrote:
  places.sqlite is mozilla's bookmarks db and I was trying to read this
  db, but so far I've been unsuccessful.
  
  sqlite ver: 2.8.17
  PHP version: PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch
  php5-sqlite: 5.3.3-1ubuntu9.6
 
 Okay, first off, mozilla uses sqlite3, not sqlite2, so you need to use
 those functions/classes instead.

Thank you Tamara.. I'll see what I can accomplish. I'm thinking even if
I do it this way, I'll still have to restart firefox for the page to
update.

-- 
Thanks,
David M.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sqlite inserts inside a PDO fetch loop

2010-05-28 Thread Phpster
Can't you do a limit in the extract SQL and mark the records extracted  
so that you don't end up extraxting the same ones?




Bastien

Sent from my iPod

On May 28, 2010, at 5:49 PM, Brandon version...@gmail.com wrote:


Hello,

I have a situation where I am trying to create an index of words  
contained in a particular table.  The table is about 9,400 rows, and  
the index ends up being 1,500,000 words (rows).  While creating the  
index, I do a select of the table, and extract the words.  I cache  
these word results into an array, and use that array for a prepared  
insert statement into the word index table.


My problem is memory.  It maxes out at about 35 MB.  This is a bit  
high, and what I would like to do is do an onset transaction when  
the array reaches a certain size, like 10,000, then unset the array  
and continue.  The problem with that is I cannot commit the insert  
while the fetch statement is still pending.


I have tried fetchAll instead, but still have similar memory issues.

I have also tried to commit the inserts at the end, but that causes  
Sqlite to hog the memory.


Is there any way to fix this, or is this just the cost of doing  
business with Sqlite?


Thanks!

B



--
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



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



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];
$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



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 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



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) {
$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 [EMAIL PROTECTED] 
 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




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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];


$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 [EMAIL PROTECTED] 
 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 [EMAIL PROTECTED] 


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








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= $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 [EMAIL PROTECTED]
 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 [EMAIL PROTECTED]

 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






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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, 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 [EMAIL PROTECTED] 


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 [EMAIL PROTECTED] 



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








--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 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= $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 [EMAIL PROTECTED]
 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 [EMAIL PROTECTED]

 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







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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_dump($sesdb-exec(UPDATE ZITEM SET ZQUANTITY=0 WHERE  
ZPRODUCTID=bli-343));


$query=SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE  
ZCategory != 14;




On 20 Aug 2008, at 11:45, Evert Lammerts wrote:


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 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= $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 [EMAIL PROTECTED] 


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 [EMAIL PROTECTED] 



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











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, Aug 20, 2008 at 12:50 PM, Amy Gibbs [EMAIL PROTECTED] wrote:
 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_dump($sesdb-exec(UPDATE ZITEM SET ZQUANTITY=0 WHERE
 ZPRODUCTID=bli-343));
 $query=SELECT ZNAME, ZQUANTITY, ZPRODUCTID FROM ZITEM WHERE ZCategory !=
 14;


 On 20 Aug 2008, at 11:45, Evert Lammerts wrote:

 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 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= $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 [EMAIL PROTECTED]

 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 [EMAIL PROTECTED]

 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









-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 open database file in/home/amy2203/public_html/ 
willowtreecrafts/seweblink/seinvaudit.php on lin


Sorry to have such a basic problem!

On 20 Aug 2008, at 11:45, Evert Lammerts wrote:


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 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= $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 [EMAIL PROTECTED] 


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 [EMAIL PROTECTED] 



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









--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





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(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 open database file
 in/home/amy2203/public_html/willowtreecrafts/seweblink/seinvaudit.php on lin
 Sorry to have such a basic problem!
 On 20 Aug 2008, at 11:45, Evert Lammerts wrote:

 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 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= $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 [EMAIL PROTECTED]

 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 [EMAIL PROTECTED]

 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







 --
 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



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 database file in/home/amy2203/public_html/ 
willowtreecrafts/seweblink/seinvaudit.php on lin


which was a permissions error on the folder,

now i'm timing out and getting nothing,

Sorry to have such a basic problem!

On 20 Aug 2008, at 11:45, Evert Lammerts wrote:


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 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= $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 [EMAIL PROTECTED] 


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 [EMAIL PROTECTED] 



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









--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





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
 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 database file
 in/home/amy2203/public_html/willowtreecrafts/seweblink/seinvaudit.php on lin
 which was a permissions error on the folder,
 now i'm timing out and getting nothing,
 Sorry to have such a basic problem!
 On 20 Aug 2008, at 11:45, Evert Lammerts wrote:

 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 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= $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 [EMAIL PROTECTED]

 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 [EMAIL PROTECTED]

 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







 --
 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



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, 2008 at 1:11 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(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 database file
 in/home/amy2203/public_html/willowtreecrafts/seweblink/seinvaudit.php on lin
 which was a permissions error on the folder,
 now i'm timing out and getting nothing,
 Sorry to have such a basic problem!
 On 20 Aug 2008, at 11:45, Evert Lammerts wrote:

 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 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= $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 [EMAIL PROTECTED]

 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 [EMAIL PROTECTED]

 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







 --
 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



Re: [PHP-DB] sqlite access causes signal 11

2005-02-04 Thread Sven Oliver Moll
On Fri, 4 Feb 2005, Sven Oliver Moll wrote:
Hello,
I'm using Serendipity (http://www.s9y.org), a blog system. Running it with
an sqlite backend, it crashes the apache instance with a signal 11. After
some analysing I can tell that the crash is processing an sqlite_query()
statement.
I created a small testcase that crashes with 5.0.3, 5.0.x-cvs and 5.1.x-cvs.
If there are any more questions please feel free to contact me.
After a nice debugging session I found out that the crash happens inside
the sqlite database itself. The bug is fixed in sqlite 2.8.15. I simply
replaced all files from ext/sqlite/libsqlite/src with their versions from
the sqlite 2.8.15 distribution. Now it works like a charm.
Greetings from Germany and singing off into the weekend!
Winke: o/~
SvOlli
--
|  ___   |
| (  /\  | For once, Microsoft wasn't exagerating when they named
|__)v\/lli a.k.a.| it the Jet Engine - your data's the seagull.
|Sven Oliver Moll|   -- Chris Adams
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] SQLite problem INSERTing string

2004-09-19 Thread Darryl

$val = 127.0.0.1;
$query = INSERT INTO node (uri,name) VALUES ('.$val.','bla');

Try that?
-Original Message-
From: Stefan Reimers [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 19, 2004 6:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQLite problem INSERTing string

Hello,

I am currently experiencing a problem with an INSERT statement in SQLite.

First of all an excerpt from the code:

$val = 127.0.0.1;
$query = INSERT INTO node (uri,name) VALUES (.$val.,'bla');

$db_name = mysqlite;

if($db_hdl = sqlite_open($db_name)){

$db_result = sqlite_query($db_hdl,$query);

}

I get the error message:

Warning: sqlite_query(): near .: syntax error in 
C:\Programme\xampp\htdocs\dipl\testclient\sqlite_test.php on line 10

I tried addslashes (which I know I shouldn't), sqlite_escape_string, any 
variant of quotes etc, I asked google and the searched the news groups 
but with no relevant result, except the insight, that others experience 
the same so long unsolved problem or use a syntax in their tutorials 
that does not work with my code...

As you an see from the error message, I use Windows, Apache, PHP4 with 
SQLite in a 2.8.14 version.

If anyone has a clue, please contact me or just answer.
Thanks in advance
Stefan

-- 
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



Re: [PHP-DB] SQLite problem INSERTing string

2004-09-19 Thread M Saleh EG
$val=127.0.0.1;
$query=INSERT INTO node set uri=\$val\, name=\bla\;

Try this one... think is better n less confusing for u...

On Sun, 19 Sep 2004 19:13:48 +0200, Darryl [EMAIL PROTECTED] wrote:
 
 $val = 127.0.0.1;
 $query = INSERT INTO node (uri,name) VALUES ('.$val.','bla');
 
 Try that?
 
 
 -Original Message-
 From: Stefan Reimers [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 19, 2004 6:37 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] SQLite problem INSERTing string
 
 Hello,
 
 I am currently experiencing a problem with an INSERT statement in SQLite.
 
 First of all an excerpt from the code:
 
 $val = 127.0.0.1;
 $query = INSERT INTO node (uri,name) VALUES (.$val.,'bla');
 
 $db_name = mysqlite;
 
 if($db_hdl = sqlite_open($db_name)){
 
$db_result = sqlite_query($db_hdl,$query);
 
 }
 
 I get the error message:
 
 Warning: sqlite_query(): near .: syntax error in
 C:\Programme\xampp\htdocs\dipl\testclient\sqlite_test.php on line 10
 
 I tried addslashes (which I know I shouldn't), sqlite_escape_string, any
 variant of quotes etc, I asked google and the searched the news groups
 but with no relevant result, except the insight, that others experience
 the same so long unsolved problem or use a syntax in their tutorials
 that does not work with my code...
 
 As you an see from the error message, I use Windows, Apache, PHP4 with
 SQLite in a 2.8.14 version.
 
 If anyone has a clue, please contact me or just answer.
 Thanks in advance
 Stefan
 
 --
 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



RE: [PHP-DB] SQLite security

2004-08-21 Thread Ed Lazor
 Shared hosting vulnerabilities have nothing to do with SQLite security.
 phpMyAdmin seems to be a popular choice for MySQL admin and I reckon
 there must be a few people who use it in shared hosting situations.

Most of the shared hosting options I've seen lately list phpMyAdmin as one
of the benefits of going with their service...

-Ed

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQLite security

2004-08-20 Thread Adam Q
You can use Mcrypt, OpenSSL or any other crypographic provider to 
encrypt
the information however for your application to be able to access the
information you would also have to store the encryption key, reducing 
the
protection offered.
Any PHP MySQL connection script has the DB password in it somewhere so 
this is not an issue I think.
phpMyAdmin allows you to put the password into a config file...
But you can't download a MySQL database by typing in a URL.

I think encryption for SQLite is essential for PHP. It makes it almost 
useless in a webscripting language.
Suppose you wanted to create an open source, easily portable, file 
based guestbook in PHP. I would never use SQLLite under the current 
circumstances... Although I would love to. It seems like the perfect 
solution.

But the database needs a password otherwise it is just too much of 
a security risk.

SQLite is intended for applications that need a database but don't 
need a
full fledged solution such as PostgreSQL
I can't think of one (1) web based application where I would recommend 
SQLite - if I can't specify a password for access.
Maybe for PHP-GTK, but that is not web based (and PHP is used a great 
deal for web scripting).

Remember regardless of the database you use if you are using a shared
hosting provider it is possible othere hosting clients will be able to
access your database regardless of the engine you use.
Shared hosting vulnerabilities have nothing to do with SQLite security.
phpMyAdmin seems to be a popular choice for MySQL admin and I reckon 
there must be a few people who use it in shared hosting situations.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] SQLite security

2004-08-16 Thread Jason Sheets
SQLite security is based primarily on filesystem security, placing the
database outside the web root (i.e. /home/user/private/SQLITE.db instead of
/home/www/SQLITE.db) and including an option in your base configuration or
include file to point to the database file.

You can use Mcrypt, OpenSSL or any other crypographic provider to encrypt
the information however for your application to be able to access the
information you would also have to store the encryption key, reducing the
protection offered.

If I were you I'd follow the first approach, in my opinion the second
approach's overhead does not justify the minimal security gained.

SQLite is intended for applications that need a database but don't need a
full fledged solution such as PostgreSQL.

Remember regardless of the database you use if you are using a shared
hosting provider it is possible othere hosting clients will be able to
access your database regardless of the engine you use.

Jason

-Original Message-
From: Adam Q [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 16, 2004 7:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQLite security

I would like to use an SQLite DB for the prefs for an open source PHP
project, but I can't find any way to be sure the DB file is going to be
secure... Is it possible to encrypt a SQLite DB file?

With the current setup, if I include a .htaccess for the DB dir, this will
only work for Apache - not IIS.
I know I can include a warning about how important it is to place the files
outside the HTTP directory tree and .htaccess files are good, but it is just
too easy to download an SQLite DB... I can't really see any PHP use that
would be OK for this really.
if I put the db file SQLITE.DB into /www/db Anybody can d/l it by typing
http://myserver.com/db/SQLITE.DB

I though I might even be able to prevent d/l by naming the DB file with a
. at the start but it makes do difference.

... and if the project is open source it is just too much of a security risk
as everybody knows where the file is going to be on a default installation.

Otherwise I'm stuck with the standard PHP prefs file confing.inc.php 
(- which is safe from prying eyes):
?
if (defined(correct_entry_point)) {
my_pref[1] = lots of good stuff;
}
?

But updating this on pref changes is no fun compared to SQLite

shrug

Please somebody tell me I'm wrong,
Cheers,
Adam

--
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-DB] [Attn] Re: [PHP-DB] SQLite behaving bad?

2004-02-18 Thread Gerard Samuel
On Tuesday 17 February 2004 04:41 pm, Gerard Samuel wrote:
 Currently using sqlite 2.8.11 (distributed by php snaps) with php4.3.5rc2
 on windows XP.
 Several months ago, I added support for sqlite in a database abstraction
 class I created.  It worked great then.
 Im trying to see if things are still ok today, and its not.
 For example executing the select query -
 select f.foo, b.bar from table f, table b where f.id = b.id;
 Should return result table fields foo and bar.
 Instead its returning result table fields f.foo and b.bar.


Just an update about this.
Due to changes in SQLite, the problem that I've described in this email, is 
now the default behaviour of SQLite.
So if you get bitten by this, its up to you to figure a way around this.


 Example script
 ?php

 // sqlite connection parameters produce $conn resource id

 $sql = 'SELECT f.foo, b.bar FROM table f, table b WHERE f.id = b.id';
 $result = sqlite_query($conn, $sql);
 if ($result === false)
 {
die('For some reason');
 }

 while($row = sqlite_fetch_array($result, SQLITE_ASSOC))
 {
 // The expected results return nothing
 var_dump($row['foo'], $row['bar']);

 // The unexpected results return data
 var_dump($row['f.foo'], $row['b.bar']);  // You get the correct values
 }

 ?

 So has anyone experienced this with the current sqlite/php combination?
 This used to work correctly with sqlite 2.8.3 (distributed by php snaps)
 Were there any notices that I may have missed over these past months??

 Thanks for any help you may provide...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQLite PRIMARY KEY.

2004-01-30 Thread Stuart Gilbert
Well, it appears I tried everything except JUST the word NULL.
Sorry for wasting your time.
Regards,
Stuart Gilbert.
Stuart Gilbert wrote:
I'm trying to get my PHP code to INSERT a new row and have the PRIMARY 
KEY field automatically set to the next available integer.
I read, somewhere, that if I send null as the primary key value then 
SQLite will automatically incrememnt it for me.

I've tried sending all sorts of things that I thought might work, but as 
yet I have not been able to get it right.

Can someone please help me?

Regards,
Stuart Gilbert.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php