View a sqlite table
Wednesday, February 25th, 2009This example shows how to view all the data in a sqlite table
<?php
//open db
if (!($db = sqlite_open(’sample.db’)))
{
die(sqlite_error_string(sqlite_last_error($db)));
}
//select all results from db
$sql = ’select * from sample order by id asc’;
if (!($result = sqlite_query($db, $sql)))
{
die(’SQL ERROR: ‘ . sqlite_error_string(sqlite_last_error($db)));
}
//display all results
while ($row = sqlite_fetch_array($result))
{
echo “{$row['id']}. {$row['cat']} . {$row['title']}<br />\n”;
}
//close
sqlite_close($db);
?>


















