\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("\n");
print("\n");
print("\n");
print("\n");
print("\n");
print("\n");
print("\n");
print("\n");
// $url_args = "&begin=$begin&page=$page&category=";
// $url_args .= urlencode($category);
// $url_args .= "&wordsearch=$wordsearch&wordoption=$wordoption&contactsearch=$contactsearch&contactoption=$contactoption";
print("
\n");
print(" |
\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("  |
\n");
$previous_category = $row_data[0];
print("\n");
$row_style = 0;
}
if($row_style & 1) print("");
else print("
");
print("");
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(" ");
}
print(" | ");
print("");
if($row_data[8] && $row_data[9]) print($row_data[8] . ":" . $row_data[9]);
else print(" ");
print(" | ");
print("
\n");
if($row_style & 1) print("");
else print("
");
print("");
if($row_data[3]) print($row_data[3]);
else print(" ");
print(" | ");
print("");
if($row_data[10] && $row_data[11]) print($row_data[10] . ":" . $row_data[11]);
else print(" ");
print(" | ");
print("
\n");
if($row_style & 1) print("");
else print("
");
print("");
if($row_data[4] && $row_data[5] && $row_data[6])
print($row_data[4] . "," . $row_data[5] . " " . $row_data[6]);
else print(" ");
if($row_data[7]) print("-" . $row_data[7]);
print(" | ");
print("");
if($row_data[12] && $row_data[13]) print($row_data[12] . ":" . $row_data[13]);
else print(" ");
print(" | ");
print("
\n");
}
print("
\n");
pg_freeresult($result);
}
else print("Search criteria yield no results.