PDO/SQLite connection

I have been working for a while on a project involving running a PHP web application on on an ARM linux mini PC. There was an existing application on the PC whose SQLite database I needed to manipulate, to feed new values into the program from a web interface. The hardest thing by far was cross-compiling PHP to run in the ARM environment to include --enable-pdo --with-pdo-sqlite, but that would take too long to go into here.

I was able to collect and display data from the SQLite database using the following PHP code:

$connect = new PDO("sqlite:/path/to/sqlite.db");

$sql = "SELECT * FROM sqlite_table";

foreach ($connect->query($sql) as $info)


echo "$val1";

Tags: , , ,

One Trackback to “PDO/SQLite connection”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: