To create an SQLite3 database and insert values from an external CSV file from PHP I ran :
$db=new SQLite3("QNH.sqlite");
$q="CREATE TABLE IF NOT EXISTS QNH(id INTEGER PRIMARY KEY,unixtimeutc INTEGER,stationqnh TEXT)";
$db->exec($q);unset($regel);$id=0;
if(($fp=fopen("QNH.csv","r"))!==false)
{while(($regel=fgetcsv($fp,32,","))!==false)
{$id++;
$q="INSERT INTO QNH VALUES('".$id."','".$regel[0]."','".$regel[1]."')";
$db->exec($q);}}
$v=fclose($fp);$db->close();
It works... but ridiculously and unuseably slow and it hits the 60 seconds timeout well before finishing. Only 733 lines were added of the 105132 in total to be added. At this pace it would need > 143 minutes. And the HD makes a lot of fuss doing this. This is obviously NOT the way to do it. I know how to create the DB and import the CSV file at the SQLite3 command prompt, this works in a matter of seconds, but I need to do this from a PHP script. I looked everywhere but couldn't find anything specific to SQLite3 and PHP. Any ideas?