Ok so im making a search function to search a site for user uploaded videos i have all of the code down out allready. but i upload it to the server and it does absolutly nothing blank page. I have a crude version of the search function that works just fine but it doesnt do what i need it to do. I have sat for hours double and triple checking my work and just cannot find any errors that could possibly give me a blank page.
ANY help would be VERY appreciated.
Thanks in advance.
The entire page of code
<? session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="swfobject.js"></script>
<link rel="stylesheet" type="text/css" href="includes/style.css"/>
<link rel="stylesheet" type="text/css" href="includes/header.css"/>
<link rel="stylesheet" type="text/css" href="includes/search.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search Results</title>
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<!--- Header --->
<div id="header">
<div class="logo">
<img src="images/logo.jpg" />
</div>
<div class="world">
<embed src="includes/world.swf" quality="high" type="application/x-shockwave-flash" width="320" height="175"></embed>
</div>
<div class="login">
<? if (isset($_SESSION['username'])){
echo "<font style='font-size:12px;'><b>";
echo "Welcome ".$_SESSION['username'];
echo "<br />";
echo "<a href='includes/logout.php'>Log Out?</a>";
echo "</font></b>";
} else {?>
<img src="images/login.jpg" width="99" height="16" style="width:100px;" /><br />
<form action="includes/login.php"method="post">
<font style="position:absolute; left:7px; top:17px;">Username:</font>
<input name="username" type="text" class="login-textbox"/>
<br /><br />
<font style="position:absolute; left:7px; top:40px;">Password:</font>
<input type="password" name="password" class="login-textbox2" />
<br />
<input type="checkbox" name="remember" style="position:absolute; top:61px; left:0px;" />
<font style="position:absolute; left:25px; top:63px;">Remember me!</font>
<input type="submit" value="Login" src="" class="login-button" />
</form>
<font style="position:absolute; left:30px; top:90px;">Not a Member?
<a href="freecap/userregistration.php">Sign up!</a></font>
<? }; ?>
</div>
<div class="search">
<img src="images/search.jpg" width="99" height="16" style="width:100px;" />
<form action="search.php" method="post">
<input name="q" type="text" style="width:92px;"/>
<input name="type" type="hidden" value="tags" />
<input type="submit" name="Search" value="Search" src=" " />
</form>
<a href="advsearch.php">Advanced Video Search</a>
</div>
<div class="navbar">
<a href="index.php" class="home visited"></a>
<a href="userview.php" class="user"></a>
<a href="promoview.php" class="promo"></a>
<a href="myaccount.php" class="myaccount"></a>
</div>
<img src="images/headerbar.jpg" class="headerbar"/>
</div>
<div id="content">
<?php
include("includes/config.php");
// Get the search variable from URL
$name = $_POST['name'];
$country = $_POST['cboCountry'];
$state = $_POST['cboState'];
$category = $_POST['cat'];
$var = $_POST['q'];
$c = 0;
// rows to return
$limit=10;
// check for an empty string and display a message.
if ($name == "" and $country == "" and $state == "" and $category == "" and $var == "")
{
echo "<p>Please go back and enter a search...</p>";
};
// set the basic query
$query = "select * from videos where";
// start determining my query by seeing which variables are set and assigning them to an array for a loop later.
if (isset($name))
{
q[$c] = ' username="'.$name.'"';
$c++;
};
if (isset($country))
{
q[$c] = ' region1="'.$country.'"';
$c++;
};
if (isset($state))
{
q[$c] = ' region2="'.$state.'"';
$c++;
};
if (isset($category))
{
q[$c] = ' cat="'.$category.'"';
$c++;
};
if (isset($var))
{
$q[$c] = ' tags like ';
$searchterms = explode(" ", $var);
for($i=0; $i<count($searchterms)-1; $i++){
$q[$c] .= "'%".$searchterms[$i]."%'";
$q[$c] .= " and tags like ";
};
$q[$c] .= "'%".$searchterms[$i]."%'";
};
//create the entire query now
for($i=0; $i<$c; $i++){
$query .= $q[$i];
};
$query .= $q[$i];
$query .= ' and approved=1';
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// If we have no results, tell user
if ($numrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
};
// next determine if s has been passed to script, if not use 0
if (empty($s)) {
$s=0;
};
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched for
echo "<p>You searched for: "" . $var . ""</p>";
// begin to show results set
echo "<p>Results</p>";
$count = 1 + $s ;
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$title = '<a href="view.php?vid='.$row['vid'].'">'.$row['vname'].'</a></p>';
echo "<p>$count.) $title" ;
$count++ ;
};
$currPage = (($s/$limit) + 1);
// next we need to do the links to other results
if ($s>=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><<
Prev 10</a>  ";
};
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
};
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$news=$s+$limit;
echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
};
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; };
$b = $s + 1 ;
echo "<p>Showing results $b to $a of $numrows</p>";
mysql_close();
?>
</div>
<!--- Footer --->
<div id="footer">
<center><embed src="../includes/adbanner.swf" quality="high" type="application/x-shockwave-flash" width="660" height="100"></embed></center>
</div>
<div id="bottom"></div>
</div>
</div>
</body>
</html>