new cleanup and updates
[home-automation.git] / sqlite.php
diff --git a/sqlite.php b/sqlite.php
new file mode 100644 (file)
index 0000000..5752d9f
--- /dev/null
@@ -0,0 +1,26 @@
+<?
+$handle = sqlite_open("boxee_catalog.db") or die("Could not open database"); 
+
+$query = "select * from audio_files";
+
+$result = sqlite_query($handle, $query) or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle)));
+
+// if rows exist
+if (sqlite_num_rows($result) > 0) {
+    // get each row as an array
+    // print values
+    echo "<table cellpadding=10 border=1>";
+    while($row = sqlite_fetch_array($result)) {
+        echo "<tr>";
+        echo "<td>".$row[0]."</td>";
+        echo "<td>".$row[1]."</td>";
+        echo "<td>".$row[2]."</td>";
+        echo "</tr>";
+    }
+    echo "</table>";
+}
+
+// all done
+// close database file
+sqlite_close($handle);
+?>