view · edit · print · history

1 Install lighttpd with fast-cgi, see HowTo to set up.

2 Install sqlite3

3 Use a .php cgi file something like this :


  <title>Your Title Here</title>

<H2> Page Heading</H2> <p>

<a href=index.html>Back</a><p>


// Get post data from a html form

$data1 = $_POST['data1']."%";

$data2 = $_POST['data2']."%"; etc

// Build query for sqlite3

$query = ".mode html\n

-- This sets sqlite3 output mode to html with table tags

SELECT * FROM table1

WHERE column1 LIKE '$data1'

AND column2 LIKE '$data2'

-- etc


// Set up table output

echo '<TABLE BORDER=2 cellpadding=4>'; echo "<tr><th>Data1<th>Data2</tr>\n";

// This is a bit of a hack, but I couldn't get any other way to work. // Hopefully not needed when sqlite support included with php5 // No file locks - not too many users I hope

$file = "query.sql";

$fh = fopen($file, 'w+');

fwrite($fh, $query);


// Send contents of query.sql to database

system ("sqlite3 beer < query.sql");

// database output goes to a foratted table

echo '</table>'; ?> <p> <a href=index.html>Back</a>



view · edit · print · history · Last edited by TimW.
Originally by TimW.
Page last modified on August 05, 2009, at 08:02 AM