I am unsure right now as to wheather or not a query is working. feel free to check it out at Cemetery Search My computer is too slow right now. Let me know if you spot any problems. Thanks in advance for your help.
I am attaching the relevant files to assist you.
Sincerely;
KB9YJG
Here is the code for the results page.
<HTML>
<head>
<title><? echo $ptitle; ?></title>
</head>
<body background=img/clouds.jpg bgproperties=fixed>
<CENTER>
<table border=0 width=50%>
<!--<LINK REL=stylesheet HREF="../inc/aagcs.css" TYPE="text/css">-->
<?
include('inc/connect.inc');
echo "<H1 align=center>Cemetery Search Results</H1>";
$table = "fwcems";
$limit = 10;
$totalrows = mysql_result(mysql_query("SELECT * FROM $table where $name LIKE %$search%"),0);
if(empty($page))
{
$page = 1;
}
$limitvalue = $page * $limit - ($limit);
$query = "SELECT * FROM $table where $name LIKE %$search% LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if($totalrows == 0)
{
echo("Nothing to Display!");
}
$bgcolor = "#FFFFFF";
// light gray
echo("<table>");
while($row = mysql_fetch_array($result))
{
if ($bgcolor == "#FFFFFF")
{
$bgcolor = "#FFFFFF";
}
else
{
$bgcolor = "#FFFFFF";
}
if ($row["cemstatus"]==0)
{
echo "Closed";
}
if ($row["cemstatus"]==1)
{
echo "Open";
}
echo("<tr bgcolor=".$bgcolor."><td align=center colspan=2><Q>");
echo($row["cemname"]);
echo(" Cemetery");
echo("</Q></td></tr>");
echo("<tr bgcolor=".$bgcolor."><td align=center colspan=2>");
echo("<Q>Located at");
echo($row["cemaddy"]);
echo("</Q></td></tr>");
echo("<tr bgcolor=".$bgcolor."><td align=center>");
echo("Status: ");
echo("</td><td align=center>");
echo($row["cemstatus"]);
echo("</td></tr>");
echo("<tr bgcolor=".$bgcolor."><td align=center>");
echo("Owner: ");
echo("</td><td align=center>");
echo($row["cemowner"]);
echo("</td></tr>");
echo("<tr bgcolor=".$bgcolor."><td align=center>");
echo("Phone #: ");
echo("</td><td align=center>");
echo($row["cemph"]);
echo("</td></tr>");
echo("<tr bgcolor=".$bgcolor."><td align=center>");
echo("E-mail address: ");
echo("</td><td align=center>");
echo($row["coemail"]);
echo("</td></tr>");
echo("<HR color=\#AA00FF\">");
echo("</td></tr>");
}
echo("</table>");
$numofpages = $totalrows / $limit;
for($i = 1; $i <= $numofpages; $i++)
{
if($i == $page)
{
echo($i." ");
}
else
{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}
if(($totalrows % $limit) != 0)
{
if($i == $page)
{
echo($i." ");
}
else
{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}
if(($totalrows - ($limit * $page)) > 0)
{
$pagenext = $page++;
echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>");
}
else
{
echo("NEXT".$limit);
}
mysql_free_result($result);
?>
</table>
</center>
</body>
</html>