<div id="catnav">
<a href="index4.php?show=DVD"> DVD</a><br />
<a href="index4.php?show=video"> Video's</a>
<br />
<br />
<form name="form1" method="post" action="search.php">
Search:
<input type="text" name="userQuery">
<input type="submit" name="Submit" value="Submit">
</form>
<?
function remove_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = remove_magic_quotes($v);
} else {
$array[$k] = stripslashes($v);
}
}
return $array;
}
if (get_magic_quotes_gpc()) {
$_GET = remove_magic_quotes($_GET);
$_POST = remove_magic_quotes($_POST);
$_COOKIE = remove_magic_quotes($_COOKIE);
}
$input = strip_tags($_POST['userQuery']);
$sql = "SELECT * FROM Table WHERE MATCH (FieldName) AGAINST ('$input');";
$result = mysql_query($sql);
while ($field = mysql_fetch_array($result))
{
$searchResults = $field['FieldName'];
echo '$searchResults';
}
?>
</div>
<div id="catcontent">
<?
$username="";
$password="";
$database="caldico_mediacat";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//If the $_get function == DVD then get execute the following statement
if($_GET['show'] == "DVD") {
//If $_get == dvd then execute the following SQL query and output the results
$query="SELECT * FROM DVD ORDER BY catagory ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$catagory=mysql_result($result,$i,"catagory");
$director=mysql_result($result,$i,"director");
$title=mysql_result($result,$i,"title");
$price=mysql_result($result,$i,"price");
$image=mysql_result($result,$i,"image");
//Output display
echo '<div align="left" class="product">';
echo "<b>Catagory: </b> $catagory <br></br>
<b> Director: </b> $director<br> </br>
<b>Title: </b>$title <br></br>
<b> Certificate: </b> $certificate<br> </br>
<b>Price: </b> $price<br></br><br>";
echo '<img src='.$image.' />';
echo "</div>";
$i++;
}
//else if $_get function == video then get execute the following statement
}elseif($_GET['show'] == "video") {
//If $_get == video then execute the following SQL query and output the results
$query="SELECT * FROM Video";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$catagory=mysql_result($result,$i,"catagory");
$director=mysql_result($result,$i,"director");
$title=mysql_result($result,$i,"title");
$certificate=mysql_result($result,$i,"certificate");
$price=mysql_result($result,$i,"price");
$image=mysql_result($result,$i,"image");
//Output display
echo '<div align="left" class="product">';
echo "<b>Catagory: </b> $catagory <br></br>
<b> Director: </b> $director<br> </br>
<b>Title: </b>$title <br></br>
<b> Certificate: </b> $certificate<br> </br>
<b>Price: </b> $price<br></br><br>";
echo '<img src='.$image.' />';
echo "</div>";
echo "</div>";
$i++;
}
}
?>
</div>