";
$db = mysql_connect($db_server,$db_user,$db_password);
mysql_select_db($db_name,$db);
if (isset($name) || isset($city) || isset($state) || isset($zip))
{
$search_par = "(";
}
if (isset($name))
{
$submit .= " where name like '%";
$submit .= $name;
$submit .= "%'";
$arg = 1;
$search_par .= "Name = \"";
$search_par .= $name;
$search_par .= "\"";
}
if(!isset($arg)) $arg=0;
if(!isset($name)) $name = "";
if(!isset($city)) $city = "";
if(!isset($state)) $state = "";
if(!isset($zip)) $zip = "";
if ($city)
{
if(!$arg)
{
$submit .= " where city = '$city'";
$arg = 1;
$search_par .= "City = \"$city\"";
}
else
{
$submit .= " and city = '$city'";
$search_par .= ", City = \"$city\"";
}
}
if ($state)
{
if(!$arg)
{
$submit .= " where state = '$state'";
$arg = 1;
$search_par .= "State = \"$state\"";
}
else
{
$submit .= " and state = '$state'";
$search_par .= ", State = \"$state\"";
}
}
if ($zip)
{
if(!$arg)
{
$submit .= " where zip like '$zip%'";
$arg = 1;
$search_par .= "Zip = \"$zip\"";
}
else
{
$submit .= " and zip like '$zip%'";
$search_par .= ", Zip = \"$zip\"";
}
}
if (isset($search_par)) $search_par .= ")
";
$get_count = "select count(*)".substr($submit,8);
//echo $get_count;
$result = mysql_db_query($db_name,$get_count);
$answ = mysql_fetch_row($result);
$rows = $answ[0];
$submit .= " order by level desc, state, city, name limit $start_where,$dinc";
$result = mysql_db_query($db_name,$submit);
if ($result)
{
if(!isset($search_par)) $search_par = "";
$start_disp = $start_where+1;
if (($start_where+$dinc) <= $rows)
$end_disp = $start_where+$dinc;
else
$end_disp = $rows;
$frows = number_format($rows,0);
echo "
$frows matching listings from $cat_nam.
$search_par
|
";
while($row = mysql_fetch_array($result)) {
$ffd = "";
if ($row['level']) $ffd = $ffd."";
$pzip = substr($row['zip'],0,5);
echo "
$ffd$row[name]
$row[address]
$row[city], $row[state] $row[zip]
Phone: $row[phone]
";
if ($row['email'])
{
echo "Email: $row[email] ";
}
if ($row['url'])
{
echo "Web Address: $row[url] ";
}
//echo "$row[id]";
echo " |
|
";
}
echo " |
|
| ";
if ($start_where >= $dinc)
echo " ";
if ($start_where < $rows-($dinc*2))
{
echo "";
}
elseif ($start_where < $rows-$dinc)
{
$i_left = $rows - $start_where - $dinc;
echo "";
}
$nsw = $start_where+$dinc;
echo " |
";
}
}
else
{
$ok = html('shome');
echo stripslashes($ok);
}
echo "";
$ok = html('sfooter');
echo stripslashes($ok);
?>