PHP Code:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_rsvendor = 10;
$pageNum_rsvendor = 0;
if (isset($_GET['pageNum_rsvendor'])) {
$pageNum_rsvendor = $_GET['pageNum_rsvendor'];
}
$startRow_rsvendor = $pageNum_rsvendor * $maxRows_rsvendor;
$varzip_rsvendor = "1";
if (isset($_POST['Zip'])) {
$varzip_rsvendor = $_POST['Zip'];
}
$varcategory_rsvendor = "1";
if (isset($_POST['Category'])) {
$varcategory_rsvendor = $_POST['Category'];
}
mysql_select_db($database_vendor, $vendor);
$query_rsvendor = sprintf("SELECT commercial.Company, commercial.Street, commercial.City, commercial.Zip, commercial.Category FROM commercial WHERE commercial.Zip=%s AND commercial.Category=%s", GetSQLValueString($varzip_rsvendor, "text"),GetSQLValueString($varcategory_rsvendor, "text"));
$query_limit_rsvendor = sprintf("%s LIMIT %d, %d", $query_rsvendor, $startRow_rsvendor, $maxRows_rsvendor);
$rsvendor = mysql_query($query_limit_rsvendor, $vendor) or die(mysql_error());
$row_rsvendor = mysql_fetch_assoc($rsvendor);
if (isset($_GET['totalRows_rsvendor'])) {
$totalRows_rsvendor = $_GET['totalRows_rsvendor'];
} else {
$all_rsvendor = mysql_query($query_rsvendor);
$totalRows_rsvendor = mysql_num_rows($all_rsvendor);
}
$totalPages_rsvendor = ceil($totalRows_rsvendor/$maxRows_rsvendor)-1;
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<p>Commercial Vendors</p>
<p> </p>
<table border="0">
<?php
if (mysql_num_rows($rsvendor) == 0) {
echo '<p>No records found.</p>';
} else {
do { ?>
<tr>
<td width="157"><?php echo $row_rsvendor['Company']; ?></td></tr>
<tr><td><?php echo $row_rsvendor['Street']; ?></td></tr>
<tr><td><?php echo $row_rsvendor['City']; ?></td></tr>
<tr><td><?php echo $row_rsvendor['Zip']; ?></td></tr>
<tr><td><?php echo $row_rsvendor['Category']; ?></td>
</tr>
<tr>
<td bgcolor="#666666"> </td>
</tr>
<?php
} while ($row_rsvendor = mysql_fetch_assoc($rsvendor)); }
?>
</table>
<?php
mysql_free_result($rsvendor);
?>
Bookmarks