Location: PHPKode > scripts > wwdgallery > wwdgallery/engine.php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>
  <?php
  //if the form has not yet been submitted
if (!$action=="search"){
?>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr> 
    <td width="55%" rowspan="2" valign="middle"> 
      <div align="center"><img src="images/rid.php?pic=random" width="250"></div></td>
    <td width="45%" valign="top"> 
      <h2>welcome to your gallery</h2>
      <p><font size="2">The exhibits displayed here etc.</font></p>
      <p><font size="2">Blurb to welcome your guest.</font></p>
      <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td width="45%" valign="middle"> 
      <?php
	  //no action means show form
Include_once('includes/form.php');
?>
    </td>
  </tr>
</table>
<p> 

<?php

}else{

//connect to database - edit here
$conn = mysql_connect("localhost", "user", "password") OR DIE (mysql_error());
@mysql_select_db ("highblue02_db", $conn) OR DIE (mysql_error());

//query based on the search form completed by the guest - edit here
$sql = "SELECT * FROM your_table WHERE ";

if (isset($_POST['category'])) { //test if category is set - to change search parameters, amend includes/search.php - edit here if needed
$sql .= "category LIKE '%$category%' ";
}
if (isset($_POST['artist'])) { //test if artist is set - edit here if needed
$sql .= "AND artist LIKE '%$artist%' ";
}
if (isset($_POST['description'])) { //test if description is set - edit here if needed
$sql .= "AND description LIKE '%$description%'";
}
$result=mysql_query($sql);
$number=mysql_num_rows($result);
//if search does not return any results
if ($number == 0){
print "<b>There are no exhibits matching your search. Please try again:</b>";
//show form again
Include_once('includes/form.php');
}else{
?>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr valign="top"> 
    <td height="40" colspan="5"> <?php echo "<b>Result of your search: $category $artist $description</b>"; //shows what guest searched for?> 
      <?php
	  //successful search dislays the results - while loops through this query to display all matching results
	  //in section below the results from each row are displayed in the table
	  //the image image source is image.php which gets the thumbnail from the database. The link pops up the full image in a new window.
while ($row=mysql_fetch_array($result))
{
?>
    </td>
  </tr>
  <tr valign="top"> 
    <td width="10%"><font size="2">Title</font></td>
    <td width="25%"><b><?php echo "{$row["name"]}";?></b></td>
    <td width="10%"><font size="2">Category</font></td>
    <td width="25%"><b><?php echo "{$row["category"]}";?></b></td>
    <td width="30%" rowspan="3" valign="middle"> 
      <div align="center"><?php echo "<a href=javascript:void(0); onclick=window.open('images/{$row["id"]}.jpg','','width=500,height=500,scrollbars=no,resizable=yes,top=0,left=0')><img src=\"image.php?id={$row["id"]}\"></a>";?> 
      </div>
      </td>
  </tr>
  <tr valign="top"> 
    <td width="10%"> <div align="left"><font size="2">Artist</font></div></td>
    <td width="25%"> <div align="left"><b><?php echo "{$row["artist"]}";?></b></div></td>
    <td width="10%"> <div align="left"><font size="2">Description</font></div></td>
    <td width="25%" rowspan="2"> <div align="left"><font size="4"></font></div>
      <?php echo "{$row["description"]}";?></td>
  </tr>
  <tr valign="top"> 
    <td width="10%"></td>
    <td width="20%"></td>
    <td width="15%"></td>
  </tr>
  <tr valign="top"> 
    <td height="40"></td>
    <td height="40"></td>
    <td height="40"></td>
    <td height="40">&nbsp;</td>
    <td height="40">
<div align="center"></div></td>
  </tr>
  <?php
}
?>
</table>
<?php
//show form again after successful search
print "<b>Search again?</b>";
//show form
Include_once('includes/form.php');
}
}
?>
</body>
</html>
Return current item: wwdgallery