Loading Images from PHP Variables

Hi all,
This - http://www.alisongreen.me.uk/majorproject/w4/ - is the project I’m currently working on. The user can submit images to 3 different sections and then browse each section. When images are uploaded they are also entered into a database. My problem is I can get all the images to load from the database but am failing to get just certain images to load when the user searches by keyword (see the ‘Past’ page). Anyone have any idea how I can do this? Here is my code so far:
Code to load all the images from the database and display them on the ‘past’ page:

_root.mc_wall_past._visible = true;
_root.txt_past._visible = true;
_root.btn_back_past._visible = true;
_root.mc_holderpast._visible = false;
myData = new LoadVars()
myData.load("db_past.php");
myData.ref = this;
myData.onLoad = function(succes){
 if(succes){
  for(var i=0; i<this.count; i++){
   fn = this['filename'+i];
   duplicateMovieClip("mc_holderpast", "mc_holderpast"+i, i)
   loadMovie("http://www.alisongreen.me.uk/majorproject/w4/past/thumbnails/" + fn, "mc_holderpast"+i);
  }
 } else trace("Error loading data")
}
stop();

Code attached to the ‘go’ button on the same page to search for (queries the database) certain images:

on(release) {
 var txtSearch = searchbox;
 myVarsPast = new LoadVars()
 myVarsPast.load("db_past_search.php");
 myVarsPast.ref = this;
 myVarsPast.onLoad = function(succes){
  if(succes){
   for(var i=0; i<this.count; i++){
    fn = this['filename'+i];
    this.ref["mc_holderpast"+i].unloadMovie("http://www.alisongreen.me.uk/majorproject/w4/past/thumbnails/" + fn);
   }
  }
 }
 getURL("http://www.alisongreen.me.uk/majorproject/w4/db_past_search.php", "_blank", "POST");
 gotoandstop(5);
//the same frame
}

The database code:

<?php 
$con = mysql_connect("localhost","iamali_w4","*************");
if (!$con){
 die('Could not connect: ' . mysql_error());
 }
mysql_select_db("iamali_w4", $con);
$search = $_POST['txtSearch'];
$result = mysql_query("SELECT * FROM tbl_past WHERE description LIKE '%$search%'");
$count = 0;
while($row = mysql_fetch_array($result)) {
 $filename = $row['filename'];
 $description = $row['description'];
 $id = $row['id'];
 echo "filename" . $count . "=" . $filename . "&" . "description" . $count . "=" . $description . "&" . "id" . $count . "=" . $id . "&";
 $count++;
 }
echo "count=" . $count;
mysql_close($con);
?>

Thanks everyone!