Problem with sqlite

My script is simple
$storagelocation = exo_getglobalvariable(‘HEPubStorageLocation’, ‘’);
$dbname = $storagelocation.‘data.sqlite’;
$dbh = new PDO(‘sqlite:’.$dbname);
$sql=“SELECT * FROM payments WHERE player=1 and flag = 0”;
$data=$dbh->query($sql);
foreach ($data as $row)
{ echo $row’pay’];
}
but get this error popup when i run the application
PHP Warning: Invalid argument supplied for foreach() in …
I think it is the connection with the database… I tried all kind of ways to fix it. I changed location of database lots of times, inside or outside the application folder.I used a db file and a sqlite and I’ ve read the sqlite connection demo but still cant seem to fix this… Any help is appreciated.

Could you check whether $dbh is correctly assigned?

Also try echo $dbname to see whether the path to the database is correct.

Well thank you for your reply.
It seems that I had the wrong SQLITE extension compiled in my file ,I was using pdo_sqlite3.dll instead of pdo_sqlite.dll.
I have another quetion though. I now load my db from inside my application directory.
Tha data from sqlite are loading fine, but when i change (insert ot update) anything in database and restart the application , my database is not updated and has always the same data as when i compiled it.
I know that this is not a bug and I must be doing something wrong.
I decided to compile my db inside the project for better security.
Is this possible? or will the databse cannot get updated while compiled in the application ?
Thank you

OK. Thanks for the follow-up about wrong SQLITE extension. That explains why sqlite fails for some users.

The database can’t be updated once compiled in the application. The sole way is to store it locally, as described in the doc: http://www.exeoutput.com/help/savingfiles
SQLite encryption possibility is being studied.