Olive Branch MS Chamber of Commerce (circa Oct 1999)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

228 lines
6.9 KiB

<html>
<head>
<title>Olive Branch, MS</title>
</head>
<link rel=stylesheet href=/styles/basic.css type=text/css>
<body>
<?
// $linesperpage = 10;
$database_name = "olivebranch";
//print("<b>Search criteria:</b><br>\n");
print("<form method=\"post\" action=\"bsearchresult.php3\">");
$connection = pg_connect("localhost", "5432", $database_name);
if($connection)
{
$multiple = 0;
$query = "SELECT * FROM member WHERE ";
if($category || $wordsearch || $contactsearch)
{
if($category)
{
$query .= "category = '" . $category . "'";
$multiple = 1;
}
if($wordsearch)
{
if($multiple) $query .= " AND ";
switch($wordoption)
{
case "start":
$query .= "upper(company) LIKE upper('" . $wordsearch . "%')";
break;
case "contain":
$query .= "upper(company) LIKE upper('%" . $wordsearch . "%')";
break;
case "end":
$query .= "upper(company) LIKE upper('%" . $wordsearch . "')";
break;
}
$multiple = 1;
}
if($contactsearch)
{
if($multiple) $query .= " AND ";
switch($contactoption)
{
case "start":
$query .= "upper(contact) LIKE upper('" . $contactsearch . "%')";
break;
case "contain":
$query .= "upper(contact) LIKE upper('%" . $contactsearch . "%')";
break;
case "end":
$query .= "upper(contact) LIKE upper('%" . $contactsearch . "')";
break;
}
}
}
else $query .= "category is not null";
$query .= " ORDER BY category,company,contact";
// print("<p><b>query:</b> " . $query . "<p>\n");
$result = pg_exec($connection, $query);
if($result)
{
$total_rows = pg_numrows($result);
if($linesperpage <= 0) $linesperpage = $total_rows;
$total_pages = (($total_rows - 1) / $linesperpage) + 1;
settype($total_pages, "integer");
switch($bsact)
{
case " < ":
$begin -= $linesperpage;
if($begin < 0) { $begin = 0; $page = 1; }
else $page--;
break;
case " > ":
$begin += $linesperpage;
if($begin > ($total_rows - $linesperpage))
{
$begin = $total_rows - $linesperpage;
$page = $total_pages;
}
else $page++;
break;
case ">>":
$begin = $total_rows - $linesperpage;
$page = $total_pages;
break;
default:
$begin = 0;
$page = 1;
break;
}
$last_row = $begin + $linesperpage;
if($last_row > $total_rows) $last_row = $total_rows;
print("<input type=\"hidden\" name=\"linesperpage\" value=\"" . $linesperpage . "\">\n");
print("<input type=\"hidden\" name=\"begin\" value=\"" . $begin . "\">\n");
print("<input type=\"hidden\" name=\"page\" value=\"" . $page . "\">\n");
print("<input type=\"hidden\" name=\"category\" value=\"" . $category . "\">\n");
print("<input type=\"hidden\" name=\"wordsearch\" value=\"" . $wordsearch . "\">\n");
print("<input type=\"hidden\" name=\"wordoption\" value=\"" . $wordoption . "\">\n");
print("<input type=\"hidden\" name=\"contactsearch\" value=\"" . $contactsearch . "\">\n");
print("<input type=\"hidden\" name=\"contactoption\" value=\"" . $contactoption . "\">\n");
// $url_arg = "&begin=$begin&page=$page&category=";
// $url_args .= urlencode($category);
// $url_args .= "&wordsearch=$wordsearch&wordoption=$wordoption&contactsearch=$contactsearch&contactoption=$contactoption";
print("<table border=0 width=\"450\" cellspacing=0 cellpadding=0><tr>");
if($total_rows > $linesperpage && $begin > 0)
{
print("<td align=left width=\"100\"><input type=\"submit\" name=\"bsact\" value=\"<<\">\n");
print("<input type=\"submit\" name=\"bsact\" value=\" < \"></td>\n");
// print("<td align=left width=\"100\"><a href=\"bsearchresult.php3?bsact=first" . $url_args . "\">First</a>\n");
// print("<a href=\"bsearchresult.php3?bsact=prev" . $url_args . "\">Prev</a></td>\n");
}
else print("<td width=\"100\"></td>\n");
print("<th align=center><b>Page $page of $total_pages</b></th>\n");
if($total_rows > $linesperpage && $begin != ($total_rows - $linesperpage))
{
print("<td align=right width=\"100\"><input type=\"submit\" name=\"bsact\" value=\" > \">\n");
print("<input type=\"submit\" name=\"bsact\" value=\">>\"></td>\n");
// print("<td align=right width=\"100\"><a href=\"bsearchresult.php3?bsact=next" . $url_args . "\">Next</a>\n");
// print("<a href=\"bsearchresult.php3?bsact=last" . $url_args . "\">Last</a></td>\n");
}
else print("<th width=\"100\"></th>\n");
print("</tr></table><br>\n");
print("<table border=0 width=450 cellspacing=0 cellpadding=0>\n");
print("<tr><td colspan=2></td></tr>\n");
for($row = $begin, $row_style=0; $row < $last_row; $row++, $row_style++)
{
$row_data = pg_fetch_row($result, $row);
if($row_data[0] != $previous_category)
{
if(isset($previous_category))
print("<tr><td colspan=2>&nbsp</td></tr>\n");
$previous_category = $row_data[0];
print("<tr class=header><th align=center colspan=2>$row_data[0]</th></tr>\n");
$row_style = 0;
}
if($row_style & 1) print("<tr class=darkrow>");
else print("<tr class=lightrow>");
print("<td align=left>");
if($row_data[1])
{
print($row_data[1]);
if($row_data[2]) print(" (" . $row_data[2] . ")");
}
else
{
if($row_data[2]) print($row_data[2]);
else print("&nbsp");
}
print("</td>");
print("<td align=right>");
if($row_data[8] && $row_data[9]) print($row_data[8] . ":" . $row_data[9]);
else print("&nbsp");
print("</td>");
print("</tr>\n");
if($row_style & 1) print("<tr class=darkrow>");
else print("<tr class=lightrow>");
print("<td align=left>");
if($row_data[3]) print($row_data[3]);
else print("&nbsp");
print("</td>");
print("<td align=right>");
if($row_data[10] && $row_data[11]) print($row_data[10] . ":" . $row_data[11]);
else print("&nbsp");
print("</td>");
print("</tr>\n");
if($row_style & 1) print("<tr class=darkrow>");
else print("<tr class=lightrow>");
print("<td align=left>");
if($row_data[4] && $row_data[5] && $row_data[6])
print($row_data[4] . "," . $row_data[5] . " " . $row_data[6]);
else print("&nbsp");
if($row_data[7]) print("-" . $row_data[7]);
print("</td>");
print("<td align=right>");
if($row_data[12] && $row_data[13]) print($row_data[12] . ":" . $row_data[13]);
else print("&nbsp");
print("</td>");
print("</tr>\n");
}
print("</table>\n");
pg_freeresult($result);
}
else print("Search criteria yield no results.<br>\n");
pg_close($connection);
print("</form>\n");
}
?>
</body>
</html>