Well, Im getting closer. I can't seem to get the query function right. Running the following program gives:
The first record is 1 0 0 0 0 BUSI @TOWB.1@ Ernest Blacksmith Shop INSERT INTO tab (i0) VALUES (1) INSERT INTO tab (i0) VALUES (1) INSERT INTO tab (i0) VALUES (1) INSERT INTO tab (i0) VALUES (1) INSERT INTO tab (i0) VALUES (2) INSERT INTO tab (i0) VALUES (2) query= php: Impossible to execute query. Looking in the php manual, there is no "query" function, but a lot of other xxx_query functions. Is this a simple problem" Thanks Frank L. ================= <?php try { $dbHandle = new PDO('sqlite:'."/Users/me/junk.sqlite"); } catch( PDOException $exception ){ die($exception->getMessage()); } $sqlCreateTable = 'create table tab(i0,i1,i2,i3,i4,t0,ID0,t1,t2,t3,t4,s,l,date,d)'; $dbHandle->exec($sqlCreateTable); $filename='/Users/me/TDD.txt'; $data1 = file_get_contents($filename); $data2 = preg_split('/\n/',$data1); // separate into records echo "\n The first record is " . $data2[0].'<br>'; $i = 0; while ($i <= 5) { $data3 = preg_split('/\t/',$data2[$i]); // tab delimited record data into array $sqlcmd = 'INSERT INTO tab (i0) VALUES ('.$data3[0].')'; echo $sqlcmd."<br>"; $dbHandle->exec($sqlcmd); $i++; } $sqlcmd = 'select * from tab where i0=2'; // select some records $query = $dbHandle->query($sqlcmd,SQLITE_BOTH,$query_error); echo "query=".$query."<br>"; if ($query_error)die("Error: $sqlite query_error"); if (!$query)die("php: Impossible to execute query."); ?> -- View this message in context: http://old.nabble.com/Sqlite-and-php-tp26754013p26763806.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users