Hello. I am one of the millions of noobs out there. I have a script designed to look up database and return search results to a table. The page however is blank so nothing is being output at all. Even the source is empty when I look at it.
So the script starts with a simple index page to enter the search term and then submit. The search.php page then has the following parsed into the browser url = search.php?query=death&submit=Search
I have tried searching google for all sorts of reasons for blank pages but none appear to help as they all appear to be unrelated.
the script i am using on the search page is below, I want to learn so some pointers would be useful please.
<?php
mysql_connect("localhost", "user", "password")
mysql_select_db("db") or die(mysql_error());
$query = $_GET['query'];
$min_length = 1;
if(strlen($query) >= $min_length)
{
$query = htmlspecialchars($query);
$query = mysql_real_escape_string($query);
echo "<table border='0' width='300' align='center'>";
echo "<tr align='center' bgcolor='#002C40' >
<td height='35px' width='150px'>Title</td>
<td>Author</td></tr>";
$raw_results = mysql_query("SELECT * FROM avathar15 WHERE
(`user` LIKE '%".$query."%') OR (`alliance` LIKE '%".$query."%')");
if(mysql_num_rows($raw_results) > 0)
{
while($results = mysql_fetch_array($raw_results))
{
echo "<tr align='center' bgcolor='#0f7ea3'>
<td height='25px'>".$results['title']."</td>
<td>".$results['text']."</td></tr>" ;
}
}
else{
echo "<tr align='center' bgcolor='#6C0000'>
<td colspan='2' height='25px'>No results</td>
<tr>";
echo "</table>";
}
}
else{
echo "Minimum length is ".$min_length;
}
?>