Re: [sqlite] Insert not working for sqlite3

2011-07-11 Thread James_21th
code is not working: $result=$dbh->query("create table tbl2 (one varchar(10),two varchar(10));"); actually 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

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)
te ____________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Stephan Beal [sgb...@googlemail.com] Sent: Monday, July 11, 2011 6:10 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Insert not working for sqlite3

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 http://wanderinghorse.net/home/

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
x27;Exception : '.$e->getMessage()."\n"; } ?> - Original Message From: "Black, Michael (IS)" To: General Discussion of SQLite Database Sent: Fri, 8 July, 2011 8:27:35 PM Subject: Re: [sqlite] Insert not working for sqlite3 I downloaded 5.3.6 from here

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, if not even able to > cr

Re: [sqlite] Insert not working for sqlite3

2011-07-08 Thread Black, Michael (IS)
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 James_21th [james_2...@yahoo.com] Sent: Thursday, July 07, 2011 8:50 PM To: General Discussion of SQLite Database Su

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
ephan Beal To: General Discussion of SQLite Database 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 wrote: > For each operation you should test the $result and check to see it's > SQLITE_OK. >

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 http://wanderinghorse.net/home/ste

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 y

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Black, Michael (IS)
orate 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 adde

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) { > > print "Error!: " . $e->getMessage() . ""; >

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 reporting option. Try instanti

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 To: General Discussion of SQLite Database Sent: Thu, 7 July, 2011 3:46:35 PM Subject: Re: [sqlite] Insert not working for sqlite3 What if you put a semicolon at the end of the query text

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread Michael Stephenson
('new1','new2')"); } catch(PDOExecption $e) { print "Error!: " . $e->getMessage() . ""; } - Original Message From: Stephan Beal To: General Discussion of SQLite Database Sent: Thu, 7 July, 2011 2:27:34 PM Subject: Re: [sqlite] I

Re: [sqlite] Insert not working for sqlite3

2011-07-07 Thread James_21th
x27;,'new2')"); } catch(PDOExecption $e) { print "Error!: " . $e->getMessage() . ""; } - Original Message From: Stephan Beal To: General Discussion of SQLite Database Sent: Thu, 7 July, 2011 2:27:34 PM Subject: Re: [sqlite] Insert not working for sqlite3 On

Re: [sqlite] Insert not working for sqlite3

2011-07-06 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 (same directory)? -- ---

Re: [sqlite] Insert not working for sqlite3

2011-07-06 Thread James_21th
The table already created with some data inside, the existing data can be display use "select * from tbl1". - Original Message From: Michael Stephenson To: General Discussion of SQLite Database Sent: Thu, 7 July, 2011 1:59:40 PM Subject: Re: [sqlite] Insert not working f

Re: [sqlite] Insert not working for sqlite3

2011-07-06 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 appreciated! > See:

Re: [sqlite] Insert not working for sqlite3

2011-07-06 Thread Michael Stephenson
ubject: [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

[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