Searching
You would need to set up a table and use PHP to connect to mySQL (research it yourself on www.php.net). Then, you would do something like this:
<?php
$q = $_GET['q'];
$query = "INSERT INTO `table_name` (column_name) VALUES ('$q')";
$result = @mysql_query($query);
if(!$result){
echo 'mySQL Query Error!! '.mysql_errno().'<br>'.mysql_error();
}
// Do whatever else you want with the search here
Now, displaying it would be best done in a different file, and calling it remotely. The file that lists the last 20 would look like:
<?php
// Gets last 20 searches
// Do database connection junk
// Select all values from the last 20 searches, ordered recent to distant
$query = "SELECT * FROM `table_name` ORDER BY id DESC LIMIT 20";
$result = @mysql_query($query);
if(!$result){
echo 'The last 20 results can't be attained at this time. Sorry.';
}
else
{
while($row = mysql_fetch_array($result)){
echo $row['search_term_column_name'].'<br>';
}
}
?>
~Brett