Re: [sqlite] Insert not working for sqlite3

2011-07-11 Thread James_21th
tually if I remove the "$result=", directly put as below: $dbh->query("create table tbl2 (one varchar(10),two varchar(10));"); Then it also works. So thank you so much everybody! James - Original Message From: "Black, Michael (IS)" <michael.bla.

Re: [sqlite] Insert not working for sqlite3

2011-07-11 Thread Simon Slavin
On 11 Jul 2011, at 2:18pm, Black, Michael (IS) wrote: > If CREATE has no return why do I get a return? Whoever wrote that isn't familiar with SQLite's habits. They don't know that most SQLite functions return a result code rather than some piece of data relating to the operating. Simon.

Re: [sqlite] Insert not working for sqlite3

2011-07-11 Thread Black, Michael (IS)
php -e enabled SQLite3 module version => 0.7-dev SQLite Library => 3.7.4 Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Steph

Re: [sqlite] Insert not working for sqlite3

2011-07-11 Thread Stephan Beal
On Mon, Jul 11, 2011 at 2:41 AM, James_21th wrote: > $result=$dbh->query("create table tbl2 (one varchar(10),two > varchar(10));"); > A CREATE statement has no results. In PDO, only SELECT (and similar) return a result, if i'm not mistaken. -- - stephan beal

Re: [sqlite] Insert not working for sqlite3

2011-07-10 Thread Simon Slavin
On 11 Jul 2011, at 1:41am, James_21th wrote: > I ran exactly the code you put below, but it only return: bool(false) > > try { > $dbh = new PDO('sqlite:db1.db'); > $result=$dbh->query("drop table if exists tbl2"); > $result=$dbh->query("create table tbl2 (one varchar(10),two varchar(10));");

Re: [sqlite] Insert not working for sqlite3

2011-07-10 Thread James_21th
xception : '.$e->getMessage()."\n"; } ?> - Original Message From: "Black, Michael (IS)" <michael.bla...@ngc.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Fri, 8 July, 2011 8:27:35 PM Subject: Re: [sqlite] Insert not

Re: [sqlite] Insert not working for sqlite3

2011-07-08 Thread Stephan Beal
On Fri, Jul 8, 2011 at 3:50 AM, James_21th wrote: > The $result always return false, it don't allow me to create a simple > table, the > table name surely not exist, I change tbl3, 4, 5, all not able to create. > (that > could be the same reason why insert is not working,

Re: [sqlite] Insert not working for sqlite3

2011-07-08 Thread Black, Michael (IS)
k Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of James_21th [james_2...@yahoo.com] Sent: Thursday, July 07, 2011 8:50 PM To: General Discussion of SQLite Database Subject: EXT :Re:

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Simon Slavin
On 8 Jul 2011, at 2:50am, James_21th wrote: > $dbh = new PDO('sqlite:db1.db'); Make sure "extension=php_pdo_sqlite.dll" is enabled in php.ini. Do a find on 'sqlite' in it and see if anything looks disabled. Specify a full path for you database file, e.g. sqlite:/opt/databases/mydb.sq3 Make

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread James_21th
han Beal <sgb...@googlemail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thu, 7 July, 2011 9:18:07 PM Subject: Re: [sqlite] Insert not working for sqlite3 On Thu, Jul 7, 2011 at 2:17 PM, Simon Slavin <slav...@bigfraud.org> wrote: > For each ope

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Stephan Beal
On Thu, Jul 7, 2011 at 2:17 PM, Simon Slavin wrote: > For each operation you should test the $result and check to see it's > SQLITE_OK. > Or enable exceptions and you don't have to check for errors (because they will cause an exception). -- - stephan beal

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Simon Slavin
On 7 Jul 2011, at 6:52am, James_21th wrote: > $dbh = new PDO('sqlite:test.db'); > $result=$dbh->query("INSERT INTO tbl1(one,two) VALUES ('new1','new2')"); Make one application which does DROP table IF EXISTS CREATE the table Do the INSERT as above Do a SELECT for that data For each operation

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Black, Michael (IS)
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of James_21th [james_2...@yahoo.com] Sent: Thursday, July 07, 2011 3:09 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Insert not working for sqlite3 semicolon added

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Jaco Breitenbach
Are you missing a COMMIT perhaps? On 7 July 2011 09:11, Stephan Beal wrote: > On Thu, Jul 7, 2011 at 9:31 AM, James_21th wrote: > > > try { > > $result=$dbh->exec("INSERT INTO tbl1(one,two) VALUES ('new1','new2')"); > > } catch(PDOExecption $e) { >

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Stephan Beal
On Thu, Jul 7, 2011 at 9:31 AM, James_21th wrote: > try { > $result=$dbh->exec("INSERT INTO tbl1(one,two) VALUES ('new1','new2')"); > } catch(PDOExecption $e) { > print "Error!: " . $e->getMessage() . ""; > } > PDO _only_ throws exceptions if you set the exceptions

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread James_21th
semicolon added and tried again, still no use. - Original Message From: Michael Stephenson <domehead...@gmail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thu, 7 July, 2011 3:46:35 PM Subject: Re: [sqlite] Insert not working for sqlite3

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Michael Stephenson
1','new2')"); } catch(PDOExecption $e) { print "Error!: " . $e->getMessage() . ""; } - Original Message From: Stephan Beal <sgb...@googlemail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thu, 7 July, 2011 2:2

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread James_21th
ot;); } catch(PDOExecption $e) { print "Error!: " . $e->getMessage() . ""; } - Original Message From: Stephan Beal <sgb...@googlemail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thu, 7 July, 2011 2:27:34 PM Subject: Re: [sqlit

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Stephan Beal
On Thu, Jul 7, 2011 at 8:24 AM, James_21th wrote: > The table already created with some data inside, the existing data can be > display use "select * from tbl1". Are you 100% sure that the test.db being opened here is the same test.db being used in the rest of he code

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread James_21th
July, 2011 1:59:40 PM Subject: Re: [sqlite] Insert not working for sqlite3 I don't see something like a "create table tbl1(one, two);" statement. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of James_21th Sent: Thursday, J

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Stephan Beal
On Thu, Jul 7, 2011 at 7:52 AM, James_21th wrote: > Dear all, > > I'm able to connect to sqlite3 DB and display the data inside, but when > insert > data, no matter how to try, just don't work, there's no error, but no data > inserted. > ... > Any feed back will be greately

Re: [sqlite] Insert not working for sqlite3

2011-07-06 Thread Michael Stephenson
t: [sqlite] Insert not working for sqlite3 Dear all,   I'm able to connect to sqlite3 DB and display the data inside, but when insert data, no matter how to try, just don't work, there's no error, but no data inserted.   Below is the simple PDO SQL I'm using, table name is "tbl1", the two

[sqlite] Insert not working for sqlite3

2011-07-06 Thread James_21th
Dear all,   I'm able to connect to sqlite3 DB and display the data inside, but when insert data, no matter how to try, just don't work, there's no error, but no data inserted.   Below is the simple PDO SQL I'm using, table name is "tbl1", the two fields name is just "one" & "two":   $dbh = new